3

I have a scala controller which puts in response's outputstream a zip file. If I use direct link, file is downloaded without problems. But when I execute request through swagger-ui, file binary content is shown on UI and loading doesn't start.

@RequestMapping(value = Array("/get-response"), method = Array(RequestMethod.GET), produces = Array(MediaType.APPLICATION_OCTET_STREAM_VALUE))
@ApiOperation(value = "api-response", notes = "Receive Response Request.")
def getResponse(response: HttpServletResponse): Unit = {
    response.setContentType("application/zip")
    response.addHeader("Content-Disposition", "attachment; filename=\"Response.zip\"");
    //writing to response.getOutputStream()
    response.flushBuffer()
}

screenshot

How can I remove the binary body and get the file downloaded? Thanks

funny-shmunny
  • 87
  • 1
  • 13
  • I had the same problem with swagger-ui, in fact its a known issue. see https://github.com/swagger-api/swagger-ui/issues/374 – Protoxy Mar 16 '16 at 10:32

0 Answers0