I'm using Spring Boot and I want send MultipartFile with json using Swagger UI but I receive the error 'application/octet-stream' error not supported,if I use Postman work very well.
@RequestMapping(value = "/upload", method = RequestMethod.POST,
produces = { "application/json" },
consumes = { "multipart/form-data" })
public String hello(
@RequestPart(value = "file") MultipartFile file,
@RequestPart("grupo") Grupo grupo) {
if (file != null) {
logger.info("File name: " + file.getOriginalFilename());
}
logger.info(grupo.toString());
return grupo.toString();
}
How to resolve this?
- springdoc-openapi-ui 1.4.4
- Spring Boot 2.3.2.RELEASE
- spring-boot-starter-web
- Maven
- spring-boot-starter-data-jpa