MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / InspectResponse

Class InspectResponse

tests/test_middleware.py:254–270  ·  view source on GitHub ↗

Records the response wrapper returned by `call_next` and passes it through.

Source from the content-addressed store, hash-verified

252
253
254class InspectResponse(Middleware):
255 """Records the response wrapper returned by `call_next` and passes it through."""
256
257 def __init__(self) -> None:
258 self.responses: list[Any] = []
259
260 @override
261 def handle(self, request: APIRequest, call_next: CallNext) -> Any:
262 response = call_next(request)
263 self.responses.append(response)
264 return response
265
266 @override
267 async def handle_async(self, request: APIRequest, call_next: AsyncCallNext) -> Any:
268 response = await call_next(request)
269 self.responses.append(response)
270 return response
271
272
273class ParseInMiddleware(Middleware):

Calls

no outgoing calls