0

I tried to upload a file using webclient like below

    val builder = MultipartBodyBuilder()
    builder.part("file", ByteArrayResource(multipartFile.bytes)).filename(multipartFile.name)

    webClient.post().uri(applicationProperties.uploadFile)
            .body(BodyInserters.fromMultipartData(builder.build()))
            .retrieve()
            .bodyToMono(UploadImageResponse::class.java)

but i have this error

{"timestamp":"2023-01-18T10:21:30.684+0000","status":415,"error":"Unsupported Media Type","message":"Content type 'multipart/form-data;charset=UTF-8;boundary=jyVJSdCWsbbhz_2obRp_ZBwOtuzLG9yaLl' not supported","path":"/api/ged/upload-file"}

Aymen Kanzari
  • 1,765
  • 7
  • 41
  • 73

0 Answers0