Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 22782

Using apache http client to upload file using multipart to spring boot

$
0
0

I have an spring boot application that has end point like this

@PostMapping("/")public ResponseEntity<FileUploadResponseDto> upload(@RequestPart("details") FileUploadDto fileUploadDto,@RequestParam("file") MultipartFile file){  try {      return ResponseEntity.ok( fileUploadService.uploadFile(fileUploadDto,file));  }catch (Exception e){      return ResponseEntity.status(406).body(new FileUploadResponseDto(false,e.getMessage()));  }};

When using postman everything works fine.This is postman exampleenter image description here

But when i try to use http apache client the spring boot returns application/octet-stream is not supported

enter image description here

What Am I doing wrong here ?


Viewing all articles
Browse latest Browse all 22782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>