Content-Type
是指 http/https 发送信息至服务器时的内容编码类型,ContentType
用于表明发送数据流的类型,服务器根据编码类型使用特定的解析方式,获取数据流中的数据。
在网络请求中,常用的 Content-Type
有如下:text/html
, text/plain
, text/css
, text/javascript
, image/jpeg
, image/png
, image/gif
, application/x-www-form-urlencoded
, multipart/form-data
, application/json
, application/xml
等。
其中:text/html
, text/plain
, text/css
, text/javascript
, image/jpeg
, image/png
, image/gif
都是常见的页面资源类型。
application/x-www-form-urlencoded
, multipart/form-data
, application/json
, application/xml
这四个是ajax的请求,表单提交或上传文件的常用的资源类型。
application/x-www-form-urlencoded
最常见 POST 提交数据的方式。浏览器的原生 form