2

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

}

Prakash Nagaraj
  • 533
  • 4
  • 12

1 Answers1

4

See line number 16 in this example upload.feature

It is a normal get

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248