Skip to content

Avoid update to request "Content-Type" for characterEncoding in ServletServerHttpRequest #36426

Closed

Description

@rstoyanchev

ServletServerHttpRequest#getHeaders re-creates the MediaType if ServletRequest#getCharacterEncoding is not null but the request "Content-Type" doesn't have a charset parameter. This is quite common in practice because the former is always true while the latter is common and fully expected, e.g. for "application/json". In turn it triggers the use of RequestHeaderOverrideWrapper.

We can update methods in ServletRequestHeadersAdapter that access header values (getFirst, get) to add special handling for "Content-Type", appending the charset lazily, and caching the result.

Activity

  1. added this to the 7.1.x milestone on Mar 6, 2026
  2. self-assigned this
    on Mar 6, 2026
  3. added
    in: webIssues in web modules (web, webmvc, webflux, websocket)
    on Mar 6, 2026
  4. ML-Marco commented on Aug 21, 2026

    @ML-Marco
  5. bclozel commented on Aug 21, 2026

    @bclozel
  6. ML-Marco commented on Aug 21, 2026

    @ML-Marco
  7. bclozel commented on Aug 21, 2026

    @bclozel
  8. ML-Marco commented on Aug 21, 2026

    @ML-Marco
  9. bclozel commented on Aug 21, 2026

    @bclozel
  10. ML-Marco commented on Aug 21, 2026

    @ML-Marco
  11. modified the milestones: 7.1.x, 7.1.0-RC1 on Oct 6, 2026
  12. added a commit that references this issue on Oct 12, 2026
    14dc30e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions