fastmcp/tests/server/http
Jeremiah Lowin a34677e10c
[3.x] Exclude Cookie from forwarded HTTP headers (#5429)
Backports #4843 from main. `get_http_headers()` now treats `cookie` as a credential header alongside `authorization`, so it is left out of the default mapping. The OpenAPI provider and the proxy transports build outgoing requests from that mapping, so their upstreams receive only the cookies the server configures itself: cookies or headers set on the OpenAPI `httpx` client, and cookie parameters the operation declares. Proxy transports continue to forward `Authorization`.

`CurrentHeaders()` still includes both credential headers, since it exposes the current request to the handler. Code that calls `get_http_headers()` and needs the cookie can ask for it by name:

```python
from fastmcp.server.dependencies import get_http_headers

headers = get_http_headers(include={"cookie"})
```

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-04 09:13:36 -04:00
..
__init__.py clean up test inits 2025-05-31 19:32:08 -04:00
test_bearer_auth_backend.py Add loq file size limits and clean up type ignores (#2859) 2026-01-13 07:29:12 -05:00
test_custom_routes.py Internal refactor of MCP handlers (#2005) 2025-10-05 08:45:10 -04:00
test_http_auth_middleware.py Restore HTTP host guard compatibility (#4472) 2026-07-08 20:16:44 -04:00
test_http_dependencies.py [3.x] Exclude Cookie from forwarded HTTP headers (#5429) 2026-10-04 09:13:36 -04:00
test_http_middleware.py fix: remove stale ty:ignore directives for ty 0.0.26 (#3684) 2026-03-28 20:02:40 -04:00
test_sse_host_origin_protection.py [3.x] Apply Host/Origin protection settings to the SSE transport (#5428) 2026-10-04 09:13:29 -04:00
test_stale_access_token.py Fix get_access_token() returning stale token after OAuth refresh (#2505) 2025-12-01 10:51:02 -05:00
test_streamable_http_shutdown.py fix(http): terminate active streamable-HTTP transports before lifespan shutdown (#4118) 2026-05-10 10:58:13 -04:00