I am new in Spring 5 and Reactive Programming. My problem is creating the export feature for the database by a rest API. User hits GET request -> Server reads data and returns data as a zip file. Because zip file is large, so I need to stream these data. My code as below:
@GetMapping(
value = "/export",
produces = ["application/octet-stream"],
headers = [
"Content-Disposition: attachment; filename=\"result.zip\"",
"Content-Type: application/zip"])
fun streamData(): Flux<Resource> = service.export()
I use curl as below:
curl http://localhost/export -H "Accept: application/octet-stream"
But it always returns 406 Not Acceptable. Anyone helps?
Thank you so much