I want to upload a video using the reactive paradigm. I am trying to create a Controller which will take Mono as @RequestPart and store it into MongoDb via reactive stream (Spring webflux).
My controller looks like this:
@PostMapping(value = "/add/react", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public Mono<ResponseEntity> upload(@RequestPart(name = "file") Mono<FilePart>fileParts) throws Exception {
return fileParts
.flatMap(part -> this.gridFsTemplate.store(part.content(), part.filename()))
.map((id) -> ok().body(Map.of("id", id.toHexString())));
}
I am trying to add a Multipart file via Postman: enter image description here
But in the end, I am receiving this message
2021-02-23 16:38:26.498 WARN 23456 --- [nio-8088-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'video/mp4' not supported]
Could you help me, please? I have searched google for 2 days and did not find anything.