?
后的字符串则为其请求参数,并以&
作为分隔符。// General Request URL: http://foo.com?x=1&y=2 Request Method: GET // Query String Parameters x=1&y=2
// General Request URL: http://foo.com Request Method: POST // Request Headers content-type: application/x-www-form-urlencoded; charset=UTF-8 // Form Data x=1&y=2
// General Request URL: http://foo.com Request Method: POST // Request Headers content-type: application/json; charset=UTF-8 // Request Payload x=1&y=2
// General Request URL: http://foo.com Request Method: POST // Request Headers content-type: multipart/form-data; charset=UTF-8 // Request Payload ------WebKitFormBoundaryAIpmgzV8Ohi99ImM Content-Disposition: form-data; name="x" 1 ------WebKitFormBoundaryAIpmgzV8Ohi99ImM Content-Disposition: form-data; name="y" 2 ------WebKitFormBoundaryAIpmgzV8Ohi99ImM--
WebKitFormBoundaryAIpmgzV8Ohi99ImM
为浏览器随机生成的boundary
,作为分隔参数,作用等同于&
。The content type "application/x-www-form-urlencoded" is inefficient for sending large quantities of binary data or text containing non-ASCII characters. The content type "multipart/form-data" should be used for submitting forms that contain files, non-ASCII data, and binary data.
multipart/form-data
的优势还伴随一些兼容性问题,详细请参考文章结束的参考文献。
https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
https://developer.mozilla.org/en-US/docs/Web/API/FormData
https://www.cnblogs.com/ChengWuyi/p/7117060.html
http://www.cnblogs.com/zourong/p/7340498.html
https://tools.ietf.org/html/draft-ietf-httpbis-p3-payload-14#section-3.2
https://stackoverflow.com/questions/23118249/whats-the-difference-between-request-payload-vs-form-data-as-seen-in-chrome
https://stackoverflow.com/questions/3508338/what-is-the-boundary-in-multipart-form-data
http请求参数之Query String Parameters、Form Data、Request Payload
原文:https://www.cnblogs.com/fxwoniu/p/14187871.html