【发布时间】:2020-08-12 00:06:21
【问题描述】:
我正在使用 Spring Boot,我想使用 Swagger UI 发送带有 json 的 MultipartFile,但我收到错误 'application/octet-stream' error not supported,如果我使用 Postman 工作得很好。
@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();
}
如何解决?
- springdoc-openapi-ui 1.4.4
- Spring Boot 2.3.2.RELEASE
- spring-boot-starter-web
- 马文
- spring-boot-starter-data-jpa
【问题讨论】:
标签: spring-boot maven swagger swagger-ui openapi