14 lines
476 B
Python
14 lines
476 B
Python
import httpx
|
|||
|
|
|
||
|
|
from .settings import settings
|
||
|
|
|
||
|
|
|
||
|
|
def downstream_client(request_id: str) -> httpx.AsyncClient:
|
||
|
|
"""An httpx.AsyncClient preconfigured with the 3s downstream timeout and
|
||
|
|
the X-Request-Id header forwarded, per phase-0-base-project-spec.md §9 --
|
||
|
|
this header is the only correlation mechanism that exists in Phase 0."""
|
||
|
|
return httpx.AsyncClient(
|
||
|
|
timeout=settings.downstream_timeout_seconds,
|
||
|
|
headers={"X-Request-Id": request_id},
|
||
|
|
)
|