Skip to content

415 Unsupported Media Type #460

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

Closed
xuanswe opened this issue Feb 27, 2020 · 2 comments
Closed

415 Unsupported Media Type #460

xuanswe opened this issue Feb 27, 2020 · 2 comments

Comments

@xuanswe
Copy link

xuanswe commented Feb 27, 2020

Describe the bug
Execute all operations, get the same error message:

{
  "timestamp": "2020-02-27T22:00:18.456+0000",
  "status": 415,
  "error": "Unsupported Media Type",
  "message": "Content type '' not supported",
  "path": "/api/todos"
}

To Reproduce
Steps to reproduce the behavior:

  • Spring boot 2.2.4.RELEASE
  • Gradle (Kotlin DSL): implementation("org.springdoc:springdoc-openapi-ui:1.2.32")
  • Kotlin JVM version 1.3.61
  • Redhat OpenJDK 11.0.3
@RestController
@RequestMapping(
    path = ["/api/todos"],
    consumes = [MediaType.APPLICATION_JSON_VALUE],
    produces = [MediaType.APPLICATION_JSON_VALUE]
)
@Tag(name = "Todo", description = "Todo API")
class TodoRestController {
    @GetMapping
    fun getTodos(@RequestParam("id", required = false) ids: Array<Int>?): ResponseEntity<List<Todo>> {
        //...
    }
}

Expected behavior
Content-Type header should be the same as configured in @RequestMapping(consumes = "...").

Screenshots
image

image

@xuanswe
Copy link
Author

xuanswe commented Feb 27, 2020

It seems that springfox-swagger2 also has the same problem.
springfox/springfox#2036

@bnasslahsen
Copy link
Collaborator

@nguyenxndaidev,

This is related to OpenAPI Specification, even its allowed in spring.
You can have a look at the following thread:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants