Skip to content

Ability to specify supported media types on FormHttpMessageConverter [SPR-7929] #12584

@spring-projects-issues

Description

@spring-projects-issues

Craig Walls opened SPR-7929 and commented

MappingJacksonJsonConverter has a setSupportedMediaTypes() method, which kinda makes sense for JSON messages, since there may not be much agreement on a JSON content type (Facebook, BTW, sends back JSON responses as "text/javascript").

FormHttpMessageConverter, on the other hand, has no such method. It is limited to supporting "application/www-form-url-encoded", which makes sense on the surface, as who would ever send url-encoded data with any other content type?

Except that Facebook's OAuth API sends back access token data in URL-encoded form, but with Content-Type set to "text/plain". Even though FormHttpMessageConverter is capable of converting the message, it won't because it doesn't support "text/plain".

For these special cases when APIs don't adhere to content types that are consistent with the response data, it'd be helpful for FormHttpMessageConverter to have a setSupportedMediaTypes() just as MappingJacksonJsonConverter has.


No further details from SPR-7929

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