下面示例中设置了请求方法,请求URL,请求参数,但是没有设置请求头
在使用过程中,请求头是根据请求参数的形式自动生成的
请求头中的content-type 与请求参数的格式之间是有关联关系的,比如
| post参数格式 | Content-Type | 参数示例 |
|---|---|---|
| 表单提交 | application/x-www-form-urlencoded | username=xiaohei&passwd=123 |
| JSON提交 | application/json | { “username”: “xiaohei”, “passwd”: “123” } |
| xml提交 | test/xml | <?xml version=”1.0” encoding=”utf—8”? > |
post请求体格式一举例:(表单格式的参数请求)

post请求体格式二举例:(JSON格式的参数请求)

请求示例:

