Sayaka617 opened a new issue, #3850:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3850

   
在接口返回值中设置responseEntity的content-type为image/png,但是请求接口时得到的content-type仍为application/octet-stream,导致浏览器无法直接呈现。
   
   接口代码如下
   ```java
       @GetMapping("/{mapId}/wms")
       @ApiResponses(@ApiResponse(code = 200, response = File.class, message = 
""))
       public ResponseEntity<ByteArrayResource> wmsExport(WmsRenderRequest 
wmsRenderRequest,
           @PathVariable("mapId") String mapId) {
           ByteArrayResource byteArrayResource = new ByteArrayResource(
               wmsMapRenderBusiness.getWmsMap(wmsRenderRequest, mapId));
   
           return ResponseEntity.ok().header(HttpHeaders.CONTENT_TYPE, 
MediaType.IMAGE_PNG_VALUE).body(byteArrayResource);
       }
   ```
   
   响应值header如下
   ```json
   {connection=keep-alive, 
content-disposition=attachment;filename=;filename*=utf-8'', 
content-type=application/octet-stream, date=Wed, 05 Jul 2023 06:43:07 GMT, 
keep-alive=timeout=60, transfer-encoding=chunked;chunked}
   ```
   
   
![image](https://github.com/apache/servicecomb-java-chassis/assets/37893549/e3b3a8f0-d4a3-4e7b-907d-d5292a52c6dc)
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to