当前位置:网站首页>Optional values and functions of the itemized contenttype parameter in the request header
Optional values and functions of the itemized contenttype parameter in the request header
2022-07-04 13:20:00 【Boyue classmate】
Count in detail contentType Optional values and functions of parameters in the request header
There was an article that said http request-header Introduction of some parameters in , It's rough , I didn't say content-type, Today, let's take a look at this humble , But the important attribute .
Want to know what is Content-Type, First of all, understand what is Internet Media Type.Internet Media Type That is, the type of Internet media , It's also called MIME type , Use a two-part identifier to determine a type . stay HTTP In the protocol header , Use Content-Type To represent the media type information in the specific request , That is to say ,Content-Type yes Internet Media Type stay HTTP Nickname in the agreement .
Content-Type The format of
type/subtype(;parameter)? type
It's on it Content-Type The format of , It can be disassembled into three parts , They are the main types (type)、 subtypes (subtype) And parameters (parameter).
Main type (type)
The main type can be any string , such as text. If it is * The number represents all types .
subtypes (subtype)
The subtype can be any string , such as html. If it is * The number represents all types .
Parameters (parameter)
Parameters are optional , Can be in Content-Type Add some special parameters to , such as Accept Parameters of request header , Common ones are used to set character encoding charset Parameters .
Content-Type: text/html;charset:utf-8;
The data type passed from the front end to the back end , Generally, there are files and pure data .
Word of the file , We use forms to upload . Data words , We use json Format upload . This is the most serious way to deal with it . Of course, there are browser native forms , Use XML Data transmission as encoding format .
Follow the order introduced in the previous paragraph , Let's introduce the corresponding parameters
1、multipart/form-data
It will process the data of the form into a message , Label as unit , Separate with separator . You can upload both key value pairs and files . Of course , Because it can append Multiple key values , So you can also upload multiple files
2、application/json
The transmission is json Formatted data , It's quite convenient to use
3、application/x-www-form-urlencoded
Browser native form Forms . Data submitted as per key1=val1&key2=val2 The way to code ,key and val It's all going on URL transcoding . Most server-side languages have good support for this approach .
4、text/xml
Compared with JSON,XML Not better for data exchange , It contains too much packaging , And it doesn't match the data model of most programming languages , To the surprise of most programmers ,XML It's data oriented ,JSON It's object-oriented and structured , The latter will give programmers a more cordial feeling .
Summary :
Choose different content-type Property value , It will let the browser convert the data in a specific format and send it to the background , At the same time, inform the server of the parameter type . If the selection is improper , The backstage partner can't receive data
边栏推荐
- AI painting minimalist tutorial
- DVWA range exercise 4
- Dgraph: large scale dynamic graph dataset
- [Android kotlin] lambda return statement and anonymous function
- n++也不靠谱
- ArcGis利用栅格处理工具进行影像裁剪
- C#/VB. Net to add text / image watermarks to PDF documents
- CANN算子:利用迭代器高效实现Tensor数据切割分块处理
- 《预训练周刊》第52期:屏蔽视觉预训练、目标导向对话
- 强化学习-学习笔记1 | 基础概念
猜你喜欢
N++ is not reliable
比量子化学方法快六个数量级,一种基于绝热状态的绝热人工神经网络方法,可加速对偶氮苯衍生物及此类分子的模拟
runc hang 导致 Kubernetes 节点 NotReady
[AI system frontier dynamics, issue 40] Hinton: my deep learning career and research mind method; Google refutes rumors and gives up tensorflow; The apotheosis framework is officially open source
强化学习-学习笔记1 | 基础概念
提高MySQL深分页查询效率的三种方案
一文掌握数仓中auto analyze的使用
Golang sets the small details of goproxy proxy proxy, which is applicable to go module download timeout and Alibaba cloud image go module download timeout
AI painting minimalist tutorial
C#/VB.NET 给PDF文档添加文本/图像水印
随机推荐
A taste of node JS (V), detailed explanation of express module
【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
Solution: how to delete the information of Jack in two tables with delete in one statement in Oracle
从0到1建设智能灰度数据体系:以vivo游戏中心为例
Apache服务器访问日志access.log设置
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
一个数据人对领域模型理解与深入
[FAQ] summary of common causes and solutions of Huawei account service error 907135701
After the game starts, you will be prompted to install HMS core. Click Cancel, and you will not be prompted to install HMS core again (initialization failure returns 907135003)
8 expansion sub packages! Recbole launches 2.0!
Reinforcement learning - learning notes 1 | basic concepts
干货整理!ERP在制造业的发展趋势如何,看这一篇就够了
《预训练周刊》第52期:屏蔽视觉预训练、目标导向对话
【云原生 | Kubernetes篇】深入了解Ingress(十二)
Golang sets the small details of goproxy proxy proxy, which is applicable to go module download timeout and Alibaba cloud image go module download timeout
WPF双滑块控件以及强制捕获鼠标事件焦点
c#数组补充
CVPR 2022 | transfusion: Lidar camera fusion for 3D target detection with transformer
SQL语言
mysql三级分销代理关系存储