MCPcopy
hub / github.com/anthropics/anthropic-sdk-python / _middleware_entry_mode

Function _middleware_entry_mode

src/anthropic/_base_client.py:2616–2623  ·  view source on GitHub ↗

The raw-response mode the original caller entered the middleware chain with.

(request: APIRequest)

Source from the content-addressed store, hash-verified

2614
2615
2616def _middleware_entry_mode(request: APIRequest) -> Literal["raw", "stream", "true"] | None:
2617 """The raw-response mode the original caller entered the middleware chain with."""
2618 headers = request.options.headers
2619 mode = headers.get(RAW_RESPONSE_HEADER) if is_given(headers) else None
2620 if isinstance(mode, str) and mode in ("raw", "stream", "true"):
2621 # mypy for some reason cannot narrow the type
2622 return mode # type: ignore
2623 return None
2624
2625
2626def _prepare_middleware_options(request: APIRequest) -> FinalRequestOptions:

Callers 2

Calls 2

is_givenFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected