Skip to content

Inconsistent Content-Type Validation in RouterFunctionMapping #35209

Closed as not planned
@AkashB23

Description

@AkashB23

In applications that use RouterFunctions—for example, Spring Cloud Gateway MVC—a GET request with an invalid or wildcard Content-Type header (e.g., /) results in an: IllegalArgumentException

📍 This behavior originates from the following line in Spring Framework:
RouterFunctionMapping.java#L212

⚠️ Issue
Unlike traditional Spring MVC applications—where Content-Type is primarily validated for POST, PUT, and PATCH requests—this validation occurs even for GET requests in the RouterFunctionMapping (there is no method based validation the exception is part of converting the servletRequest to ServerRequest.

This leads to an inconsistent experience and unexpected failures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions