I need to receive a csv file on the request and process it.
@PostMapping(value = "/csv", consumes = "text/csv")
public ViewObject postCsv(@RequestBody InputStream request){
// do stuff
}
But when I execute:
curl -X POST -H 'Content-Type: text/csv' -d @input.csv http://localhost:8080/csv
This is what shows up on my console:
Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'text/csv;charset=UTF-8' not supported]
Spring is saying my request is invalid before anything else.
So, the question is: How to properly receive this csv?