I'm trying to add uploading zip files to my Spring REST API but I keep getting an error of not being able to consume application/zip
org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/zip' not supported
Here is my function in my controller,
@RequestMapping(value = "/zip", method = RequestMethod.POST, consumes = "application/zip")
public ResponseEntity<String> uploadZip(@RequestBody InputStream inputStream) {
try {
uploadZip(inputStream)
return new ResponseEntity<String>(HttpStatus.CREATED);
} catch (IOException e) {
logger.warn("Error reading file", e);
return new ResponseEntity<String>(HttpStatus.BAD_REQUEST);
} catch (Exception e) {
logger.error("Error creating new job", e);
return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
What is causing this exception?