如何使用空手道测试下载 api

2023-12-15

我有一个用于文件下载的 api (txt,.doc,*.csv)在java中使用spring框架。我想使用空手道进行验收测试。我该怎么做。

这是我的代码

@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 行upload.feature

这是正常现象get

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用空手道测试下载 api 的相关文章

随机推荐