Skip to content

文件下载经过Edge网关后,报错提示content-type not supported #1184

@HsbGitHub

Description

@HsbGitHub

文件下载经过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 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()));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions