Hi I have a spring webflux application. I wanted an API for uploading a file. I followed the instruction in Spring Webflux 415 with MultipartFile
And wrote something like this
@PostMapping(consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public Mono<Void> save(@RequestPart("file") Mono<FilePart> file) {
log.info("Storing a new file. Recieved by Controller");
this.storageService.store(file);
return Mono.empty();
}
But still i cannot test this, it fails with the below error in postman and swagger doesnt generate file browse button for this API.
org.springframework.web.server.UnsupportedMediaTypeStatusException: Response status 415 with reason "Content type 'image/png' not supported"
at org.springframework.web.reactive.result.method.annotation.AbstractMessageReaderArgumentResolver.readBody(AbstractMessageReaderArgumentResolver.java:206) ~[spring-webflux-5.0.4.RELEASE.jar:5.0.4.RELEASE]
at org.springframework.web.reactive.result.method.annotation.AbstractMessageReaderArgumentResolver.readBody(AbstractMessageReaderArgumentResolver.java:124) ~[spring-webflux-5.0.4.RELEASE.jar:5.0.4.RELEASE]