简体   繁体   中英

Spring boot to allow any content type in headers for GET request

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 
}

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM