application/octet-stream
时间: 2023-08-06 09:03:43 浏览: 1817
application/octet-stream是一种通用的二进制数据流类型,常用于文件下载。在后端开发中,可以通过设置接口返回的Content-Type为application/octet-stream来告诉前端该接口返回的是二进制文件数据。前端可以根据接口返回的Content-Type来判断进行下一步的处理。比如,如果Content-Type为application/json,可以将返回的数据解析为JSON格式进行处理;如果Content-Type为application/octet-stream,可以将返回的数据作为文件进行下载或其他处理。在后端代码中,可以通过设置请求头的content-type为application/octet-stream来接收二进制文件数据。例如,在Java Spring框架中,可以使用@PostMapping注解设置headers为content-type=application/octet-stream来接收二进制文件数据。\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* *2* [前端接收 type: “application/octet-stream“ 格式的数据并下载,解决后端返回不唯一](https://blog.csdn.net/qq_53145332/article/details/123595850)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [SpringBoot:使用application/octet-stream 流式上传大文件,解决Mutipartfile multipart/form-data上传...](https://blog.csdn.net/weixin_43859729/article/details/130420774)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文