Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media type fails to match types with multiple '+' characters [SPR-15795] #20350

Closed
spring-issuemaster opened this issue Jul 19, 2017 · 1 comment

Comments

@spring-issuemaster
Copy link
Collaborator

commented Jul 19, 2017

Ben Draut opened SPR-15795 and commented

The logic in MimeType.includes and MimeType.isCompatibleWith appears to have a bug, in that they assume there will only be one + character in the media type string.

For example, application/*+json does not include a media type of the form application/x.y+z+json.

My understanding from the RFC is that multiple + characters are allowed, and everything following the last + defines the syntax suffix.

The code in MimeType is using ```
indexOf('+')

```lastIndexOf('+')
``` instead.

Steps to reproduce:

Use `RestTemplate` to make an HTTP request with a custom `Content-Type` header of `application/x.y+z+json`. An error is thrown:

org.springframework.web.client.RestClientException: Could not write request: no suitable HttpMessageConverter found for request type...


Proposed change: https://github.com/spring-projects/spring-framework/pull/1481

Referenced from: pull request #1481, and commits d7a7b08

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 24, 2017

Rossen Stoyanchev commented

More current spec RFC 6838, section 4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.