【发布时间】:2020-09-24 21:11:04
【问题描述】:
我正在尝试为 REST APi 创建单元测试,但在上传 excel 方法时遇到了很大问题。
这是控制器端的方法
@RestController()
@RequestMapping(path = "/upload")
@CrossOrigin(origins = "http://localhost:4200")
public class FileController {
@Autowired
FileService fileService;
@PostMapping(value = "/{managerId}/project/{projectId}")
public List<Task> importExcelFile(@RequestParam("file") MultipartFile files, @PathVariable int managerId,
@PathVariable int projectId) throws IOException, ParseException {
return fileService.getTasksFromExcel(files, managerId, projectId);
}
无论我尝试什么,都会遇到很多错误,显然我并不真正了解我应该做什么。
我得到的主要错误是
current request is not a multipart request
【问题讨论】:
标签: spring-boot spring-mvc junit