现象:使用postman测试响应ContentType没有值
这是我的部分代码:
@Override
public void download(Long buildingId, HttpServletResponse response) throws IOException {
......
IoUtil.write(response.getOutputStream(), true, bytes);
response.setContentType(imageType);
......
}
解决:
在操作流之前setContentType。原因还没有研究明白后续补充,希望对你有帮助
@Override
public void download(Long buildingId, HttpServletResponse response) throws IOException {
......
response.setContentType(imageType);
IoUtil.write(response.getOutputStream(), true, bytes);
......
}