Commit Graph

1 Commits

Author SHA1 Message Date
Jonathan Fulton d201fdcdfa feat: automatically support HEAD method for all GET routes (#1773)
Following HTTP semantics and Starlette's behavior, GET routes now
automatically respond to HEAD requests. HEAD returns the same headers
as GET but with an empty body.

Changes:
- Add HEAD to methods set when GET is present in APIRoute
- Skip auto-added HEAD (when paired with GET) in OpenAPI schema generation
- Update generate_unique_id to use deterministic method selection
- Add comprehensive tests for HEAD method support

This allows HEAD requests to work out of the box for cache validation
and resource checks, without requiring developers to define explicit
HEAD routes.

Explicit HEAD routes still work when defined before GET routes.

Fixes #1773
2026-01-31 19:14:13 -05:00