当前位置:网站首页>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
边栏推荐
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- 比量子化学方法快六个数量级,一种基于绝热状态的绝热人工神经网络方法,可加速对偶氮苯衍生物及此类分子的模拟
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- "Pre training weekly" issue 52: shielding visual pre training and goal-oriented dialogue
- A taste of node JS (V), detailed explanation of express module
- Dry goods sorting! How about the development trend of ERP in the manufacturing industry? It's enough to read this article
- 二分查找的简单理解
- 实战:fabric 用户证书吊销操作流程
- 提高MySQL深分页查询效率的三种方案
- Apache服务器访问日志access.log设置
猜你喜欢
Practice: fabric user certificate revocation operation process
C#/VB.NET 给PDF文档添加文本/图像水印
Reinforcement learning - learning notes 1 | basic concepts
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
Transformer principle and code elaboration (pytorch)
DGraph: 大规模动态图数据集
实战:fabric 用户证书吊销操作流程
Xue Jing, director of insight technology solutions: Federal learning helps secure the flow of data elements
AI painting minimalist tutorial
8个扩展子包!RecBole推出2.0!
随机推荐
Reinforcement learning - learning notes 1 | basic concepts
老掉牙的 synchronized 锁优化,一次给你讲清楚!
【Android Kotlin】lambda的返回语句和匿名函数
PostgreSQL 9.1 soaring Road
请问大佬们有遇到这个情况吗,cdc 1.4 连接MySQL 5.7 无法使用 timestamp
实战:fabric 用户证书吊销操作流程
[leetcode] 96 and 95 (how to calculate all legal BST)
Master the use of auto analyze in data warehouse
面试官:Redis 过期删除策略和内存淘汰策略有什么区别?
Besides, rsync+inotify realizes real-time backup of data
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
Simple understanding of binary search
N++ is not reliable
【AI系统前沿动态第40期】Hinton:我的深度学习生涯与研究心法;Google辟谣放弃TensorFlow;封神框架正式开源
Etcd 存储,Watch 以及过期机制
《预训练周刊》第52期:屏蔽视觉预训练、目标导向对话
c#数组补充
"Tips" to slim down Seurat objects
Why can the implementation class of abstractdispatcherservletinitializer be called when initializing the web container
7 月数据库排行榜:MongoDB 和 Oracle 分数下降最多