Skip to content

Fix media type API version fallback to Content-Type - #37620

Closed
noojung wants to merge 1 commit into
spring-projects:mainfrom
noojung:media-type-api-version-fallback
Closed

noojung wants to merge 1 commit into
spring-projects:mainfrom
noojung:media-type-api-version-fallback

Conversation

@noojung

@noojung noojung commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

MediaTypeParamApiVersionResolver returns the parameter of the first compatible Accept media type even when it has no version parameter, so the version in Content-Type is not checked. For example, Accept: */* with Content-Type: application/json;version=3 resolves to null.

This PR continues searching compatible Accept media types for a version and falls back to Content-Type if none is found, in both Spring MVC and WebFlux. A version in Accept still takes precedence over the one in Content-Type.

This addresses the server side of #37619. The client side is not changed.

An unversioned compatible Accept media type causes API version
resolution to return null before checking Content-Type.

Continue searching when the version parameter is absent, allowing
Content-Type fallback in MVC and WebFlux.

See spring-projectsgh-37619

Signed-off-by: Hyunwoo Jung <hyunwoojung@kakao.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 31, 2026
@rstoyanchev rstoyanchev self-assigned this Nov 11, 2026
@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Nov 11, 2026
@rstoyanchev rstoyanchev added this to the 7.0.11 milestone Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Fixed via 522ca1e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants