Last active
July 29, 2020 09:35
-
-
Save eaiman-shoshi/c5482b2c977c32776a3040e4f16669a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@PostMapping(value = "/upload-multiValueMap", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_STREAM_JSON_VALUE) | |
@ResponseStatus(value = HttpStatus.OK) | |
public Mono<YourResponseClass> uploadFileMap(@RequestBody Mono<MultiValueMap<String, Part>> filePartMapMono) { | |
return filePartMapMono.flatMap(this::sendFile); | |
} | |
private Mono<YourResponseClass> sendFile (MultiValueMap<String, Part> filePartMap) { | |
return webClient.post() | |
.uri("YOUR_ENDPOINT") | |
.contentType(MediaType.MULTIPART_FORM_DATA) | |
.body(BodyInserters.fromMultipartData(filePartMap)) | |
.retrieve() | |
.bodyToMono(YourResponseClass.class); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment