feign调用文件上传服务,传参MultipartFile

Required request part ‘file‘ is not present

将MultypartFile name 设为 接口参数。

        MultipartFile multipartFile = new MockMultipartFile("file", fileName,
                ContentType.MULTIPART.toString(), new FileInputStream(file));
        return this.fileUploadFeign.handleFileUpload(multipartFile);

定义feign接口:

    @PostMapping(value = "/v1/files", consumes = "multipart/*", headers = "content-type=multipart/form-data")
    String handleFileUpload(@RequestPart("file") MultipartFile file);

 

feign调用文件上传服务,传参MultipartFile

上一篇:HTTP请求响应信息字段总结(长期更新)


下一篇:查询/删除url中的参数