I'm trying to Send a Multipart File using WebClient :
public Mono<UploadReportDto> uploadOffers(MultipartFile file) {
return this.offerWebClient.getOfferWebClient(WebClient.builder()).post()
.uri("/upload")
.contentType(MediaType.MULTIPART_FORM_DATA)
.body(BodyInserters.fromMultipartData("file", file))
.retrieve()
.bodyToMono(UploadReportDto.class);
}
The Response I get :
{
"timestamp": "2023-07-24T09:32:12.441+00:00",
"status": 500,
"error": "Internal Server Error",
"trace": "org.springframework.core.codec.CodecException: Type definition error: [simple type, class sun.nio.ch.ChannelInputStream]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class sun.nio.ch.ChannelInputStream and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile[\"inputStream\"])
}