【发布时间】:2019-07-08 13:07:11
【问题描述】:
您好,谁能解释一下您如何为request 设置type 以及给定html 元素的response 的类型?
示例:
如果我想发送 form 发送一些 files 和 POCO 并接收 stream 我会使用 type=multipart/form-data ;在这种情况下,type 是指request 还是预期的响应?
<form type="multipart/form-data"><input type="file"></form>
在这种情况下,type 显然是指请求。但这意味着处理请求的server 必须将response.type 设置为application/octet-stream。
所以遵循这个原因我认为你在form 中设置的是request 类型。
然而那么我就无法理解这个矛盾:
<a class="button" type="application/octet-stream" href="http://localhost:5300/get" download>Click here for dld</a>
在我没有在这里设置响应的type之前无法下载文件。我尝试在服务器中设置响应类型但它不起作用。所以在这个这里的大小写 type 指的是response,而不是request。
有人可以解释一下吗?是否有包含html 元素的列表
type 指的是什么? (request 或预期的response 的类型)?
PS
长话短说:为什么form type 指的是request 而a 指的是response。想要发送一个请求,其内容类型为A,而他的响应类型为B。
【问题讨论】:
标签: html http content-type