-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Status Quo
Although it is currently possible to add a custom supported MediaType to FormHttpMessageConverter, it is a bit cumbersome since the List returned by getSupportedMediaTypes() is immutable, which leads to code similar to the following.
FormHttpMessageConverter converter = // ...
List<MediaType> supportedMediaTypes = new ArrayList<>(converter.getSupportedMediaTypes());
supportedMediaTypes.add(new MediaType("text", "custom-type"));
converter.setSupportedMediaTypes(supportedMediaTypes);Proposal
It would be great if adding a custom media type was as simple as the following, where addSupportedMediaTypes() accepts a var-args list.
FormHttpMessageConverter converter = // ...
converter.addSupportedMediaTypes(new MediaType("text", "custom-type"));Related Issues
Deliverables
- Introduce
addSupportedMediaTypes(MediaType...)inFormHttpMessageConverter.
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement