当前位置:网站首页>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
边栏推荐
- ArcGis利用栅格处理工具进行影像裁剪
- 8个扩展子包!RecBole推出2.0!
- 诸神黄昏时代的对比学习
- 一个数据人对领域模型理解与深入
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
- Configure WebDAV server on Apache
- "Pre training weekly" issue 52: shielding visual pre training and goal-oriented dialogue
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- 三星量产3纳米产品引台媒关注:能否短期提高投入产出率是与台积电竞争关键
猜你喜欢

众昂矿业:为保障萤石足量供应,开源节流势在必行

Full arrangement (medium difficulty)

ISO 27001 Information Security Management System Certification

Comparative study of the gods in the twilight Era

室外LED屏幕防水吗?

eclipse链接数据库中测试SQL语句删除出现SQL语句语法错误

C#/VB.NET 给PDF文档添加文本/图像水印

How real-time cloud interaction helps the development of education industry

洞见科技解决方案总监薛婧:联邦学习助力数据要素安全流通

It is six orders of magnitude faster than the quantum chemical method. An adiabatic artificial neural network method based on adiabatic state can accelerate the simulation of dual nitrogen benzene der
随机推荐
爬虫练习题(一)
Annual comprehensive analysis of China's mobile reading market in 2022
7 月数据库排行榜:MongoDB 和 Oracle 分数下降最多
XILINX/system-controller-c/BoardUI/无法连接开发板,任意操作后卡死的解决办法
golang 设置goproxy代理的小细节,适用于go module下载超时,阿里云镜像go module下载超时
七、软件包管理
强化学习-学习笔记1 | 基础概念
7、 Software package management
微服务入门
Dgraph: large scale dynamic graph dataset
Configure WebDAV server on Apache
Transformer principle and code elaboration (pytorch)
Agile development / agile testing experience
Master the use of auto analyze in data warehouse
从0到1建设智能灰度数据体系:以vivo游戏中心为例
C#/VB.NET 给PDF文档添加文本/图像水印
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
Apache服务器访问日志access.log设置
ArcGis利用栅格处理工具进行影像裁剪
AI 绘画极简教程