美文网首页工具类工作生活
Content-Type的两种请求方式

Content-Type的两种请求方式

作者: cs0710 | 来源:发表于2019-07-01 16:08 被阅读0次

在封装请求库的过程中,我们会有两种请求内容的类型。一种是application/json,另一种是application/x-www-form-urlencoded。


相应的POST请求的body体使用如下

application/x-www-form-urlencoded

POST  HTTP/1.1
Host: www.demo.com
Cache-Control: no-cache
Postman-Token: 81d7b315-d4be-8ee8-1237-04f3976de032
Content-Type: application/x-www-form-urlencoded

key=value&testKey=testValue

application/json

POST  HTTP/1.1
Host: www.demo.com
Cache-Control: no-cache
Postman-Token: 81d7b315-d4be-8ee8-1237-04f3976de032
Content-Type: application/json

{key1: 'key1', key2: []}

相关文章

网友评论

    本文标题:Content-Type的两种请求方式

    本文链接:https://www.haomeiwen.com/subject/jjtncctx.html