Common formats for HTTP content-type content types

This column brings together some often-forgotten knowledge about HTML. It is a way to review the past and learn the new. Often these fragmentary knowledge points can have a surprising effect in your development. None of us have a photographic memory or the ability to remember things for a long time, so let this little bit of knowledge slowly penetrate into your mind.
The style of this column is succinct and clear.


Content-Type generally refers to the Content-Type that exists in a web page. It is used to define the type of network file and the encoding of the web page, and determines the form and encoding in which the browser will read the file. The Content-Type header tells the client the content type of the actual content returned.

Syntax format:

Content-Type: text/html; charset=utf-8
Content-Type: multipart/form-data; boundary=something

Common media format types are as follows:

text/html: HTML format
text/plain: plain text format
text/xml: XML format
image/gif: gif image format
image/jpeg: jpg image format
image/png: png image format

Media format types starting with application:

application/xhtml+xml: XHTML format
application/xml: XML data format
application/atom+xml: Atom XML aggregation format
application/json: JSON data format
application/pdf: pdf format
application/msword: Word document format
application/octet-stream : Binary stream data (such as common file downloads)
application/x-www-form-urlencoded : The default encType in the form data is encoded into key/value format and sent to the server (the default submission data format of the form)

Another common media format is used when uploading files:

multipart/form-data: This format needs to be used when uploading files in a form.

The difference between formdata and json:

All data transmitted from the front end is binary data
1. The content-type is different.
2. We have serialized json, but the form data still needs to be processed, although the back-end framework has already processed it for us.
form data:
Insert image description here
json:
Insert image description here

There is a special format in formdata:

multipart/form-data
Insert image description here

This format is a message passed, which is equivalent to putting a message in the message body, which provides convenience for file upload. It processes the form data into a message, with tags as units and separated by delimiters. You can upload both key-value pairs and files. When the uploaded field is a file, there will be Content-Type to indicate the file type; content-disposition to describe some information about the field;
due to boundary isolation, multipart/form-data can upload both files and Key-value pair, it uses key-value pairs, so multiple files can be uploaded.

Conclusion

HTML is the skeleton of front-end page display, and its applications are everywhere. I hope some knowledge points can help you. Friends who are learning GIS are welcome to communicate with you.
"Openlayers comprehensive examples 200+" ,
"leaflet example tutorials 100+" ,
"Cesium example tutorials 100+" ,
"MapboxGL example tutorials 100+" .

Guess you like

Origin blog.csdn.net/cuclife/article/details/135213843