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

Mallforme Content-Type is not translated to 415 status code [SPR-10982] #15610

Closed
spring-issuemaster opened this issue Oct 11, 2013 · 0 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Oct 11, 2013

Jan Dudek opened SPR-10982 and commented

I believe there's a glitch in org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver#readWithMessageConverters(...). At the beginning of this method the Content-Type header must be obtained:

MediaType contentType = inputMessage.getHeaders().getContentType();
if (contentType == null) {
    contentType = MediaType.APPLICATION_OCTET_STREAM;
}

If the getContentType() call fails (for example for Content-Type: Hello), a InvalidMediaTypeException is thrown.

I believe this exception should be caught here and re-thrown as HttpMediaTypeNotSupportedException which would be eventually translated to a 415 http status code (since in my opinion this is a 415 situation).


Affects: 3.2.4

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.