How to test download api using karate

删除回忆录丶 提交于 2019-12-02 02:46:51

问题


I have an api for file download (txt,.doc,*.csv) using spring framework in java.i wanted to do acceptance testing using karate .how can i do that.

here is my code

@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);

}


回答1:


See line number 16 in this example upload.feature

It is a normal get



来源:https://stackoverflow.com/questions/49081135/how-to-test-download-api-using-karate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!