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

Class InspectResponse

tests/test_middleware.py:253–269  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Calls

no outgoing calls