http请求中的Content-Type

2017-08-05  本文已影响646人  番薯大佬

http头部字段Content-Type约定请求和响应的HTTP body内容编码类型,客户端和服务端根据http头部字段Content-Type正确解码HTTP body内容。

常见的http头部Content-Type:

示例说明

如果不明确指定http Request头部Content-Type,将使用application/x-www-form-urlencoded; charset=UTF-8作为默认值,后端方法不能解码Content-Type:application/x-www-form-urlencoded的http Request body内容。同时也说明后端方法只能解码请求头部Content-Type为application/json的http Request body内容。

上一篇 下一篇

猜你喜欢

热点阅读