Reputation: 529
I get the following error because client is sending content-type as multipart/form-data and my controller method is GET.
org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found
Is there a way in spring boot which will allow the controller to accept any content type in header?
@GetMapping("/logic")
public ResponseEntity<HttpStatus> appLogic(){
//application logic
}
Upvotes: 1
Views: 741
Reputation: 7792
Why is your URI is /content-type
? Is this on purpose? If it is it is confusing. "content-type" is a headser for HTTP request and Response. In Request this header tells server-side what is actual type of data sent in request body. Since method GET
does not allow request body this header for GET
request is meaningless. your error tells you that request notified server (through setting header content-type
to value multipart/form-data
) that request body will be of type multipart/form-data
, but request didn't contain any such data, and could not have contained it since GET
can not have a body. If you need to pass some info in request body you will need to use method POST
or PUT
Upvotes: 1