Reputation: 2546
I have this spring rest controller:
@RestController
@RequestMapping("/communications")
class CommunicationController(private val service: CommunicationService) {
@ApiOperation(
produces = APPLICATION_JSON_VALUE,
consumes = APPLICATION_JSON_VALUE
)
@GetMapping(
consumes = [APPLICATION_JSON_VALUE],
produces = [APPLICATION_JSON_VALUE]
)
fun findAll(
criterias: CommunicationCriterias,
page: Pageable
): List<CommunicationDTO> = service.findCommunications(criterias, page)
}
When I test this endpoint via the swagger-ui
(springfox) interface, i got a 415: content type invalid
error. It seems that content-type: application/json
is not set in the header.
What is missing ?
Upvotes: 8
Views: 7227
Reputation: 401
There is nothing to consume in HTTP GET request. I think you should remove the consumes
from @GetMapping
and @ApiOperation
.
Upvotes: 1