You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2019/04/16 07:11:35 UTC

[GitHub] [servicecomb-java-chassis] HsbGitHub opened a new issue #1184: 文件下载经过Edge网关后,报错提示content-type not supported

HsbGitHub opened a new issue #1184: 文件下载经过Edge网关后,报错提示content-type not supported
URL: https://github.com/apache/servicecomb-java-chassis/issues/1184
 
 
   文件下载经过Edge网关后,报错提示content-type not supported,不走网关是可以的。
   错误提示:
   {
       "message": "method GET, path /netdisk/file_download/, statusCode 200, reasonPhrase OK, response content-type application/octet-stream is not supported"
   }
   
   接口代码:
   @ApiResponses({
               @ApiResponse(code = 200, response = File.class, message = "")
       })
       @GetMapping(value = "/file_download")
       public ResponseEntity<InputStream> fileDownload(InvocationContext ic , FileDownloadReq req) {
           String fileName = req.getFileName();
           String fileStr = super.doFileDownload(OutApiServerEnum.TY_HUI_JIAO_YUN.getValue(), ic, fileName);
   
           return ResponseEntity
                   .ok().header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_OCTET_STREAM_VALUE)
                   .header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename="+fileName)
                   .body(new ByteArrayInputStream(fileStr.getBytes()));
       }
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services