fastmcp/tests/utilities/openapi
Bill Easton 7dd573980a
fix: OpenAPI request director sends multipart and form-urlencoded as JSON (#3932)
* fix: OpenAPI request director content-type dispatch and cookie params

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Stringify multipart form values and cookie params for httpx

httpx rejects non-string scalars in files= and cookies=.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Add tests for non-string multipart values and cookie stringification

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Consolidate to single httpx.Request construction point

Eliminate early returns by using variables for files/data kwargs.
All httpx body kwargs accept None, so we set exactly one and
pass all to a single Request() call.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Use _query_scalar_to_str for multipart booleans, add tuple passthrough test

Reuse existing boolean serialization (true/false not True/False) for
multipart form fields. Add test for file-like tuple passthrough.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Normalize media type for dispatch, use OpenAPI serialization for cookies

- Strip content-type parameters (e.g. "; charset=utf-8") and lowercase
  before matching, so variants like "Multipart/Form-Data" match correctly
- Use _query_scalar_to_str for cookie values (true/false not True/False)
- Add boolean cookie test

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Preserve media-type parameters in Content-Type header

Use raw_content_type (with charset etc.) for the outgoing header,
normalized form only for dispatch matching.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Pass bytes/file-like values directly in multipart, add charset preservation test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 16:28:55 -04:00
..
__init__.py Switch to new OpenAPI parser as default (#2513) 2025-12-01 20:29:18 -05:00
conftest.py Switch to new OpenAPI parser as default (#2513) 2025-12-01 20:29:18 -05:00
test_allof_requestbody.py Switch to new OpenAPI parser as default (#2513) 2025-12-01 20:29:18 -05:00
test_circular_references.py Split large test files to comply with loq line limit (#3328) 2026-02-28 11:21:11 -05:00
test_direct_array_schemas.py Switch to new OpenAPI parser as default (#2513) 2025-12-01 20:29:18 -05:00
test_director.py fix: OpenAPI request director sends multipart and form-urlencoded as JSON (#3932) 2026-04-14 16:28:55 -04:00
test_legacy_compatibility.py Switch to new OpenAPI parser as default (#2513) 2025-12-01 20:29:18 -05:00
test_models.py Add CIMD (Client ID Metadata Document) support for OAuth (#2871) 2026-02-06 13:44:52 -05:00
test_nullable_fields.py fix: prevent schema mutation in _prune_param and _convert_nullable_field (#3927) 2026-04-14 12:10:27 -04:00
test_parser.py Switch to new OpenAPI parser as default (#2513) 2025-12-01 20:29:18 -05:00
test_propertynames_ref_rewrite.py OpenAPI: rewrite $ref under propertyNames and patternProperties in _replace_ref_with_defs; add regression test for dict[StrEnum, Model] (#3306) 2026-02-26 16:08:54 -05:00
test_schemas.py Make $ref dereferencing optional via FastMCP(dereference_refs=...) (#3151) 2026-02-11 13:45:37 -05:00
test_transitive_references.py Split large test files to comply with loq line limit (#3328) 2026-02-28 11:21:11 -05:00