postman中测试同时支持文件和参数 ,文件和对象作为参数

postman 中测试同时支持文件和参数 文件和对象作为参数

前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到网站点击跳转浏览。

今天遇到一个bug
原本的方法体是这样的

@RequestMapping(value = "/configFileUpload/", method=RequestMethod.GET)
public void modelUpload(@RequestParam MultipartFile addBatchFile, @RequestBody ConfigFile configFile) throws IOException {}

但是一直报错
后来查了查,是参数的问题

 @RequestMapping(value = "/configFileUpload", method=RequestMethod.GET)
    public void modelUpload(@RequestPart("file") MultipartFile file, @RequestPart("configFile") ConfigFile configFile) throws IOException {}

改成这样,并且postman 中测试的

postman中测试同时支持文件和参数 ,文件和对象作为参数_第1张图片

然后就测试通过了
参考
https://zhuanlan.zhihu.com/p/585706264
https://blog.csdn.net/weixin_50158735/article/details/115768430

你可能感兴趣的:(Spring,Boot,postman,java,测试工具)