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()
}
How can I remove the binary body and get the file downloaded? Thanks