HTTP之请求消息Request
客户端发送一个HTTP请求到服务器的请求消息包括以下格式:
请求行(request line)、请求头部(header)、空行和请求数据四个部分组成。
例如:
POST /user HTTP/1.1
Host: 114.116.68.2:8099
Content-Length: 109
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Cache-Control: no-cache
Origin: chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
Postman-Token: 3671aa60-3370-0eec-a599-df182e228bed
Content-Type: text/plain;charset=UTF-8
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
{"token":"",
"bizCode":"1008",
"action":"",
"data":{
"userName":"135*****2513",
"identifyCode":"426975"
}
}
Charles调试HTTP请求
手机和电脑连接同一个wifi
设置手机HTTP代理,点击“设置->无线局域网->连接的WiFi”
服务器为电脑IP地址:如192.168.1.169
端口:8888
Postman调试HTTP接口
1、上传文件(Content-Type: multipart/form-data)
注意:
不需要在headers里面设置Content-Type;
key值为file
2、普通post请求(Content-Type: text/plain;charset=UTF-8)