Skip to content

Missing "consumes" on controller method results in Content-Type set to */* #275

@AlfSimen

Description

@AlfSimen

If for example a @PostMapping annotation on a RestController does not have the "consumes" variable set to anything, the org.springdoc.core.MethodAttributes.fillMethods method uses org.springframework.http.MediaType.ALL_VALUE as the value, which is */*.

This results in Spring throwing an exception saying java.lang.IllegalArgumentException: Content-Type cannot contain wildcard type '*' in org.springframework.http.HttpHeaders.setContentType

Could it be possible that instead of using */*, you would instead fill the array with a set of MediaTypes so that one could choose in the Swagger-ui, or default to org.springframework.http.MediaType.APPLICATION_JSON_VALUE if the class is a RestController?

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions