Skip to content

Fix templated Content-Type handling in SpringEncoder - #1406

Open
yashdotdev13 wants to merge 1 commit into
spring-cloud:mainfrom
yashdotdev13:issue-116-dynamic-content-type
Open

Fix templated Content-Type handling in SpringEncoder#1406
yashdotdev13 wants to merge 1 commit into
spring-cloud:mainfrom
yashdotdev13:issue-116-dynamic-content-type

Conversation

@yashdotdev13

Copy link
Copy Markdown
Contributor

Description

Fixes #116

SpringEncoder previously attempted to parse an unresolved templated Content-Type value, such as {Content-Type}, using MediaType.valueOf(...), which resulted in an invalid media type exception.

This change handles unresolved Content-Type templates by skipping media type parsing and removing the unresolved template before creating the HttpHeaders passed to Spring's message converters.

Changes

  • Skip MediaType parsing for unresolved Content-Type templates.
  • Remove unresolved Content-Type templates from headers passed to message converters.
  • Add a regression test for encoding requests with a templated Content-Type header.

Testing

  • Added a regression test in SpringEncoderTests.
  • Verified the targeted unit and integration tests.
  • Ran the full build successfully:
mvn clean verify

Signed-off-by: 98001yash <yashchauhan.gaya@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamically set Content-Type via @RequestHeader

2 participants