Skip to content

Comments

Add content negotiation via custom MIME types (#1573)#2189

Merged
jeremydmiller merged 2 commits intomainfrom
GH1573
Feb 15, 2026
Merged

Add content negotiation via custom MIME types (#1573)#2189
jeremydmiller merged 2 commits intomainfrom
GH1573

Conversation

@jeremydmiller
Copy link
Member

Summary

  • Adds [AcceptsContentType] attribute to allow multiple HTTP endpoints sharing the same route + HTTP method, differentiated by Content-Type header
  • Implements ASP.NET Core MatcherPolicy (ContentTypeEndpointSelectorPolicy) to filter candidate endpoints during routing based on request Content-Type
  • Supports RFC 6839 +json suffix types (e.g. application/vnd.item.v1+json) for JSON deserialization in HttpHandler
  • Automatically wires up correct OpenAPI metadata via Metadata.Accepts() for custom content types

Closes #1573

Test plan

  • Route to correct v1 endpoint by Content-Type header
  • Route to correct v2 endpoint by Content-Type header
  • Content-Type matching is case-insensitive
  • Existing JSON posting tests pass with no regressions (7/7)

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits February 15, 2026 17:02
…1573)

Allow multiple HTTP endpoints to share the same route and HTTP method,
differentiated by Content-Type header using [AcceptsContentType] attribute.
Uses ASP.NET Core MatcherPolicy to filter candidates during routing and
supports RFC 6839 +json suffix types for JSON deserialization.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ame route

OpenAPI 3.0 doesn't support multiple operations with the same path+method,
so configure ResolveConflictingActions for Swashbuckle compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Content negotiation via custom MIME types conveyed in HTTP Content-Type header

1 participant