如何使用空手道测试下载API [英] How to test download api using karate
本文介绍了如何使用空手道测试下载API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个使用java.spring中的spring框架进行文件下载( txt, .doc,*.csv)的api.我想使用空手道进行验收测试. >
这是我的代码
@RequestMapping(path = "/download", method = RequestMethod.GET)
public ResponseEntity<Resource> download(String param) throws
IOException {
InputStreamResource resource = new InputStreamResource(new FileInputStream(file));
return ResponseEntity.ok()
.headers(headers)
.contentLength(file.length())
.contentType(MediaType.parseMediaType("application/octet-stream"))
.body(resource);
}
解决方案
请参见本示例中的第16行 } See line number 16 in this example It is a normal 这篇关于如何使用空手道测试下载API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! 解决方案 upload.feature
get
查看全文