I want to upload a .png file and storage that.when I send it with content-type=multipart/form-data I receive this Exception
org.springframework.web.HttpMediaTypeNotSupportedException: Content type
'application/octet-stream' not supported .
I think my application doesn't understand form-data contentType and throws an irrelevant exception. What's wrong?
@Controller
public class ProfileController {
private static final Logger logger = LoggerFactory.getLogger(ProfileController.class);
@Autowired
ProfileService service;
//http : http --pretty all --form PUT localhost:8080/profile/v1?thumb=glb
@PutMapping(value = "/v1")
public Mono<ResponseEntity<String>> upload(@RequestPart(value = "thumb", required = false) String thumbFilterName,
@RequestPart(value = "genthumb", required = false) String genthumb,
@RequestPart("hash") String hash,
@RequestPart("uploader") Long uploader,
@RequestPart("file") MultipartFile file) throws Exception {
System.out.println(thumbFilterName);
System.out.println(gentumb);
System.out.println(uploader);
System.out.println(file);
//and doing storage stuff!
return Mono.just(ResponseEntity.ok().build());
}
}
and this is my Rest Client that is used for sending file. Pay attention to response.
These are screenshots of restClient. Sending file with restClient:

And this is setting headers
