MCPcopy
hub / github.com/encode/httpx / App

Class App

tests/client/test_auth.py:23–35  ·  view source on GitHub ↗

A mock app to test auth credentials.

Source from the content-addressed store, hash-verified

21
22
23class App:
24 """
25 A mock app to test auth credentials.
26 """
27
28 def __init__(self, auth_header: str = "", status_code: int = 200) -> None:
29 self.auth_header = auth_header
30 self.status_code = status_code
31
32 def __call__(self, request: httpx.Request) -> httpx.Response:
33 headers = {"www-authenticate": self.auth_header} if self.auth_header else {}
34 data = {"auth": request.headers.get("Authorization")}
35 return httpx.Response(self.status_code, headers=headers, json=data)
36
37
38class DigestApp:

Calls

no outgoing calls