I am working on typical Spring Boot REST API project and I am trying to figure out why all my POST and PUT endpoints API are getting "Unsupported Media Type" error if I don't specify Content-Type: application/json header.(so, if I unchecked Content-Type: application/json header in Postman, I get this error and everything works fine if I check that.)
Do I need to specify? Are there any ways that I can make them work without Content-Type: application/json header?
Thanks in advance,
You can always use the @RestController
for the controller and use the appropriate method like @GetMapping, @PostMapping to make this work. So, basically spring requires content type because the input could be anything.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.