http content-type

multipart/form-data,application/x-www-form-urlencoded

一. Content-Type: multipart/form-data

Multipart/form-data请求一般用于文件上传,自定义分隔符boundary,然后在每部分数据前后插入boundary。正是有boundary的隔离,multipart/form-data格式才具备上传文件和参数的能力。典型的请求如下:

POST /api/update HTTP/1.1
Host: easeapi.com
Content-Type: multipart/form-data;boundary=easeapi.com
Accept-Encoding: gzip, deflate
Connection: keep-alive
Accept: */*
User-Agent: easeapi/3.3.4 (iPhone; iOS 11.3)
Referer: easeapi.com
Content-Length: 21662
Accept-Language: en-us

--easeapi.com
Content-Disposition: form-data; name="head"; filename="file"
Content-Type: image/jpeg

【文件数据略】
--easeapi.com
Content-Disposition: form-data; name="tzoffset"
【协议要求:参数名后紧跟两个换行符,才是参数的值】
28800
--easeapi.com
Content-Disposition: form-data; name="net"

WiFi
--easeapi.com
Content-Disposition: form-data; name="language"

en
--easeapi.com

二. Content-Type: application/x-www-form-urlencoded

会将表单内的数据转换为键值对,比如:key1=value1&key2=value2