As requested here is the new issue @poutsma
My server receive a multipart, take the FilePart from the incoming request and rename it in the outgoing request. Something like that:
public Mono<ResponseEntity<SomeEntityId>> upload(
@RequestBody Mono<MultiValueMap<String, Part>> parts) {
return someServiceClient.upload(parts.map(m -> (FilePart) m.get("foo").get(0)); //here I take the foo part
}
public Mono<ResponseEntity<SomeEntityId>> upload(
Mono<MultiValueMap<String, Part>> partsMono) {
return multipartFile.flatMap(file -> {
MultipartBodyBuilder multipartBodyBuilder = new MultipartBodyBuilder();
multipartBodyBuilder.part("bar", file); //here I rename it to bar
return webClient.post()
.uri("uri")
.header(HttpHeaders.CONTENT_TYPE, MediaType.MULTIPART_FORM_DATA.toString())
.body(BodyInserters.fromMultipartData(multipartBodyBuilder.build()))
});
}
I came across this issue when upgrading my spring version : when I do this, in the outgoing request, the part that I wanted to rename "bar" is still named "foo". It worked in spring 5.2.8 (it renamed the part) but in 5.3.6 the file is not renamed anymore. I think it's related to this commit e537844 and to the issue #26410
Do you have any advice ? Thanks.