Я хочу загрузить файл .png и хранилище, которое. Когда я отправляю его с content-type = multipart / form-data, я получаю это исключение
org.springframework.web.HttpMediaTypeNotSupportedException: Content type
'application/octet-stream' not supported .
Я думаю, что мое приложение не понимаетform-data contentType и выдает неактуальное исключение.Что не так?
@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());
}
}
и это мой клиент Rest, который используется для отправки файла.Обратите внимание на ответ.
Это скриншоты restClient.Отправка файла с restClient:
![sending file with restClient](https://i.stack.imgur.com/266WU.png)
И это настройки заголовков
![and this is setting headers](https://i.stack.imgur.com/6uWEj.png)