fastmcp/tests/server
Jeremiah Lowin d12d46b049
Exclude content-type header from get_http_headers() to prevent HTTP 415 errors (#3104)
Fixes #3097

When using FastMCP.from_openapi() with APIs that require specific
Content-Type headers (e.g., application/vnd.api+json), the transport
connection's content-type: application/json was being injected into
downstream API requests, causing HTTP 415 (Unsupported Media Type) errors.

This change adds content-type to the exclude_headers set in get_http_headers(),
similar to how accept is already excluded. The MCP transport's content type
has no relevance to downstream API calls and should not be forwarded.

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Jeremiah Lowin <jlowin@users.noreply.github.com>
2026-02-06 20:19:36 -05:00
..
auth Remove require_auth; fix auth docs re: component-level enforcement (#3103) 2026-02-06 20:08:50 -05:00
http Exclude content-type header from get_http_headers() to prevent HTTP 415 errors (#3104) 2026-02-06 20:19:36 -05:00
middleware Add ResponseLimitingMiddleware for tool response size control (#3072) 2026-02-06 18:13:26 -05:00
mount Consolidate test fixtures and refactor large test files (#2941) 2026-01-19 15:18:35 -05:00
providers Infer MIME types from OpenAPI response definitions (#3101) 2026-02-06 20:08:08 -05:00
sampling SEP-1577: Sampling with tools (#2551) 2025-12-14 13:51:05 -05:00
tasks feat(context): Add background task support for Context (SEP-1686) (#2905) 2026-02-02 19:28:42 -05:00
telemetry Add component versioning and VersionFilter transform (#2894) 2026-01-16 20:53:18 -05:00
transforms Rename Enabled transform to Visibility (#2950) 2026-01-19 20:46:58 -05:00
versioning Consolidate test fixtures and refactor large test files (#2941) 2026-01-19 15:18:35 -05:00
__init__.py restore 1.x code 2025-04-09 11:54:42 -04:00
test_app_state.py Update docs and test 2025-06-20 13:06:48 -04:00
test_auth_integration.py Update FastMCP for MCP SDK 1.23.1 auth changes 2025-12-03 11:50:08 -05:00
test_context.py Move session visibility logic to enabled.py (#2924) 2026-01-19 08:29:23 -05:00
test_dependencies.py Fix ty 0.0.14 compatibility and upgrade dependencies (#3027) 2026-01-29 09:10:42 -05:00
test_event_store.py Replace type: ignore[attr-defined] with isinstance assertions in tests (#2665) 2025-12-21 16:37:20 -05:00
test_file_server.py Add MCP-compliant pagination for list operations 2026-01-17 19:30:24 -05:00
test_icons.py Implement icon support (#2121) 2025-10-17 17:28:08 -04:00
test_input_validation.py Replace type: ignore[attr-defined] with isinstance assertions in tests (#2665) 2025-12-21 16:37:20 -05:00
test_log_level.py Refactor server.py into mixins (#2939) 2026-01-19 11:36:00 -05:00
test_logging.py Refactor server.py into mixins (#2939) 2026-01-19 11:36:00 -05:00
test_pagination.py Address review feedback: validation and edge cases 2026-01-17 19:50:33 -05:00
test_providers.py Unify discovery API: deduplicate at protocol layer only (#2919) 2026-01-18 21:01:53 -05:00
test_run_server.py Update tests for prompts 2025-06-04 16:37:41 -04:00
test_server.py Add session-specific visibility control via Context (#2917) 2026-01-18 22:31:06 -05:00
test_server_docket.py Make pydocket optional and unify DI systems (#2835) 2026-01-10 16:23:32 -05:00
test_server_lifespan.py fix: broaden combine_lifespans type to accept Mapping return types (#3005) 2026-01-28 15:54:59 -05:00
test_session_visibility.py Rename Enabled transform to Visibility (#2950) 2026-01-19 20:46:58 -05:00
test_streamable_http_no_redirect.py Improve redirect handling to address 307's (#1387) 2025-08-08 11:55:30 -04:00
test_tool_annotations.py Unify discovery API: deduplicate at protocol layer only (#2919) 2026-01-18 21:01:53 -05:00
test_tool_transformation.py Add enabled field to ToolTransformConfig (#2991) 2026-01-22 17:44:38 -05:00