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-projects-issues opened this issue Jul 19, 2017 · 1 comment
Assignees
Labels
in: core type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues 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-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jul 24, 2017

Rossen Stoyanchev commented

More current spec RFC 6838, section 4.2.

@spring-projects-issues spring-projects-issues added type: enhancement in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0 RC4 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants