In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "what is the role of Content Type attributes", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "what is the role of Content Type attributes" bar!
The server usually knows how the message body in the request is encoded according to the Content-Type field in the request header (headers), and then parses the body. So when it comes to the data submission scheme of POST, it includes two parts: Content-Type and message body coding.
The value type of Content-Type:
Application/json: the message body is a serialized jsON string
Application/x-www-form-urlencoded: data is encoded as name / value pairs. This is the standard coding format.
Multipart/form-data: you need to use this format when you need to upload files in the form. Common media formats are used when uploading files
Text/plain: data is encoded in plain text (text/json/xml/html) and does not contain any controls or format characters
Content-Type action
The difference between application/json and application/x-www-form-urlencoded
Application/json:
Function: tell the server that the subject content of the request is a string in json format, and the server will parse the json string
Benefits: front-end staff do not need to care about the complexity of the data structure, as long as the standard json format can be successfully submitted.
Application/x-www-form-urlencoded: is the default Ajax request method for Jquery
Function: the data will be serialized in the form of key-value pairs during the request. Send it to the server in key1=value1&key2=value2 mode
Benefit: all browsers support
Application/x-www-form-urlencoded: information data is encoded as name / value pairs, which is the standard and default encoding format
When action is get, the client converts the form data into a string append to url, using'?' Split.
When action is post, the browser encapsulates the form data into httpbody and sends it to server. (you can cancel the pre-check request for the post request)
Thank you for your reading, the above is "what is the role of the Content Type attribute" content, after the study of this article, I believe you have a deeper understanding of the role of the Content Type attribute, the specific use of the need for our practice to verify. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.