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

Class InspectResponse

tests/test_middleware.py:281–297  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

279
280
281class InspectResponse(Middleware):
282 """Records the response wrapper returned by `call_next` and passes it through."""
283
284 def __init__(self) -> None:
285 self.responses: list[Any] = []
286
287 @override
288 def handle(self, request: APIRequest, call_next: CallNext) -> Any:
289 response = call_next(request)
290 self.responses.append(response)
291 return response
292
293 @override
294 async def handle_async(self, request: APIRequest, call_next: AsyncCallNext) -> Any:
295 response = await call_next(request)
296 self.responses.append(response)
297 return response
298
299
300class ParseInMiddleware(Middleware):

Calls

no outgoing calls