fastmcp/tests/utilities
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
..
json_schema_type fix: resolve list[dict] return type producing Root() instead of dicts (#3880) 2026-04-12 17:54:00 -04:00
openapi fix: OpenAPI request director sends multipart and form-urlencoded as JSON (#3932) 2026-04-14 16:28:55 -04:00
__init__.py restore 1.x code 2025-04-09 11:54:42 -04:00
test_async_utils.py Fix async partial callables rejected by iscoroutinefunction (#3438) 2026-03-07 12:10:09 -05:00
test_auth.py feat: option to add upstream claims to the FastMCP proxy JWT (#2997) 2026-01-28 15:57:24 -05:00
test_cli.py Fix path resolution in install commands (#1951) 2025-09-29 20:04:12 -04:00
test_components.py Update ty ignore comments for 0.0.25 compatibility (#3614) 2026-03-24 20:26:26 -04:00
test_docstring_parsing.py Extract parameter descriptions from docstrings (#3872) 2026-04-12 13:43:48 -04:00
test_inspect.py Split large test files to comply with loq line limit (#3328) 2026-02-28 11:21:11 -05:00
test_inspect_icons.py Split large test files to comply with loq line limit (#3328) 2026-02-28 11:21:11 -05:00
test_json_schema.py fix: prevent schema mutation in _prune_param and _convert_nullable_field (#3927) 2026-04-14 12:10:27 -04:00
test_logging.py Add enable_rich_logging setting to disable rich formatting (#2893) 2026-01-16 20:29:29 -05:00
test_skills.py fix: prevent path traversal in skill download (#3493) 2026-03-15 11:22:13 -04:00
test_tests.py Add FASTMCP_TRANSPORT setting for default transport selection (#1796) 2026-03-02 18:08:59 -05:00
test_token_cache.py Extract TokenCache utility, add caching to GitHubTokenVerifier (#3547) 2026-03-18 15:26:09 -04:00
test_typeadapter.py Fix method-bound tools (#1360) 2025-08-04 09:41:05 -04:00
test_types.py Preserve kw-only defaults when rebuilding functions for resolved annotations (#3429) 2026-03-07 12:10:01 -05:00
test_version_check.py Add CLI update notifications (#2840) 2026-01-10 18:27:03 -05:00