What is the difference between form data and request payload and Query String Parameters?

explain the difference between form data and request payload and Query String Parameters, whether to use post or get request, how to set content-type and so on

Mar.16,2021

Demo: http://wfquery.top/demo/07.fo.

  • formdata when you use FormData to submit POST request data (you can submit blob data, that is, file upload is supported), the data is submitted in request.plaload
by default.
$.ajax({
  type: 'POST',
  url: '/',
  form: $('form')
});

clipboard.png
https://github.com/shy2850/wf...

  • GETquerystring

clipboard.png

clipboard.png

  • if you use POST to submit querystring, you need to set Content-Type: 'application/x-www-form-urlencoded', data to be submitted through xhr.send (data)

https://github.com/shy2850/wf.

  • the above is a more common form data submission method. You can also directly submit json format strings and the like. The server can also directly submit buffer when you get the whole query and go to parseJSON, file upload when the xhr.send (buffer) file is uploaded.
as a matter of fact, whether the "Content-Type" of the request header needs to be set at the front end is entirely determined by the server. Whether the above is in querystring-param or query-json format, it can be submitted in the same location. Therefore, in many cases, we need to set the format interaction specification for the agreement between the front and back end. You can also define the rules yourself without following this convention in the project.

The format of

URL is as follows:
scheme://user:password@host:port/path;params?query-sharpfrag

The

query section is Query String Parameters

. The request message format of

HTTP is as follows

<method>  <request-URL>  <version>

<header>

<entity-body>

request payload and form data are the contents of entity-body blocks, but parsing behaviors are distinguished by Content-type .
generally form-data is `Content-type=application/x-www-form-urlencoded
the rest generally defaults to request payload (I don't know if the file is uploaded, but you can search it if you are interested).

Query String Parameters you can bring it regardless of the request method, depending on whether you want to parse it or not.
entity-body requires partial request methods
POST , PUT , PATCH , DELETE , OPTIONS , (UN) LINK , LOCK , PROPFIND , VIEW
and so on.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2276b-2ad96.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2276b-2ad96.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?