There are generally three types of Content-Type in Http Header: application/x-www-form-urlencoded
: Data is encoded as a name/value pair. This is the standard encoding format. multipart/form-data
: The data is encoded as a message, and each control on the page corresponds to a part of the message. text/plain
: The data is encoded in plain text (text/json/xml/html) without any control or formatting characters. The postman software is marked with RAW.
enctype
The attribute of form is the encoding method, there are two commonly used: application/x-www-form-urlencoded
and multipart/form-data
, the default is application/x-www-form-urlencoded
.
When the action is get, x-www-form-urlencoded
the encoding method used by the browser converts the form data into a string (name1=value1&name2=value2...), and then appends the string to the url, ?
splits it, and loads the new url.
When the action is post, the browser encapsulates the form data into the http body and sends it to the server. If there type=file
is no control, use the default application/x-www-form-urlencoded on it. But if type=file
there is, it will use multipart/form-data.
When the action is post and the Content-Type type is multipart/form-data
, the browser will divide the entire form in units of controls, and add Content-Disposition (form-data or file), Content-Type (default is text/plain) to each part ), name (control name
) and other information, and add a separator (boundary).