当前位置:网站首页>Summary of differences between data submission type request payload and form data
Summary of differences between data submission type request payload and form data
2022-07-25 07:10:00 【Breeze and drizzle_ Lin Mumu】
The outline
1. What is? `Request Payload`, What is? `Form Data`
2. Different `Content-Type` Corresponding to different submission methods
3. summary
graphics :
1. What is? Request Payload, What is? Form Data
Request Payload (http Request body mode )
Form Data ( Form request body mode )
Request Payload Corresponding :
Content-Type:application/json
Form Data Corresponding :
Content-Type: application/x-www-form-urlencoded
and
Content-Type: multipart/form-data
remarks : Forms (POST request ) The coding
<form action="/xxxx" method="get" enctype="application/x-www-form-urlencoded"><form action="/xxxx" method="get" enctype="multipart/form-data"><form action="/xxxx" method="get" enctype="text/plain">
| type | meaning |
|---|---|
| application/x-www-form-urlencoded | Default encoding , Encode data into key value pairs |
| multipart/form-data | Upload form file |
| text/plain | String type , Data acquisition method getInputStream |
2. Different Content-Type Corresponding to different submission methods
General types in data transmission are only 3 Kind of
1.Content-Type: text/plain
2.Content-Type: application/x-www-form-urlencoded
3.Content-Type: application/json
Tradition
ajax Request modeContent-Type:text/plain
function submit2() {
var xhr = new XMLHttpRequest();
xhr.timeout = 3000;
var obj = {
a: 1, b: 2};
xhr.open('POST', '/');
xhr.send(obj);
}
Need to pass through xhr.send(JSON.stringify(obj)) Modify to string and transfer .
Content-Type: text/plain
Request Payload: # character string
axios The wayrequestContent-Type:application/json and Content-Type: application/x-www-form-urlencoded
function submit3() {
var sence1 = 'name=123&val=456';
var sence2 = {
name: 123, val: 456};
axios.post('/', sence1)
}
# Request data is “ character ” when :
Content-Type: application/x-www-form-urlencoded
Form Data: #name=123&val=456
# Request data is “ object ” when :
Content-Type:application/json
Request Payload: #{name:123,vla:456}
Form FormsSubmit
<form action="/" method="POST">
<input name="name" type="text">
<input name="password" type="text">
<button> Submit </button>
</form>
Content-Type: application/x-www-form-urlencoded
Form Data: # name='xxx'&password='yyy'
3. summary
Content-Type The difference of
| Pattern | type |
|---|---|
| ajax | Content-Type The default is “ Text ” type |
| form Submit | Content-Type The default is “Form” type |
| axios Pass string | Content-Type The default is “Form” type |
| axios Transfer object | Content-Type The default is “JSON” type |
边栏推荐
- Mathematics Olympiad vs Informatics Olympiad (July 19, 2022)
- 2022天工杯CTF---crypto1 wp
- 列表推导式
- The income of bank financial management is getting lower and lower. Now which financial products have high income?
- Price reduction, game, bitterness, etc., vc/pe rushed to queue up and quit in 2022
- LeetCode118. 杨辉三角
- 【电脑讲解】NVIDIA发布GeForce RTX SUPER系列显卡,游戏玩家福利来了!
- 【obs】视频包发送的dts_usec 计算
- Discuss the important factors that affect the success or failure of automated testing
- Precautions for starting up the server of Dahua Westward Journey
猜你喜欢

机器人工程-教学品质-如何判定

EFCore高级Saas系统下单DbContext如何支持不同数据库的迁移

【愚公系列】2022年7月 Go教学课程 015-运算符之赋值运算符和关系运算符

微生物健康,不要排斥人体内微生物

章鱼网络 Community Call #1|开启 Octopus DAO 构建

Leetcode sword finger offer brush question notes

Box horse "waist cut", blame Hou Yi for talking too much?

What are the hazards of insufficient sleep?

YOLOv7模型推理和训练自己的数据集

集群聊天服务器:项目问题汇总
随机推荐
批量导入数据,一直提示 “失败原因:SQL解析失败:解析文件失败::null”怎么回事?
js数据类型的判断——案例6精致而优雅的判断数据类型
From the era of portal to the era of information flow, good content has been ignored?
代码中的软件工程:正则表达式十步通关
Go basic notes_ 5_ Process statement
第一启富金怎么样
How to learn C language?
Teach you to use cann to convert photos into cartoon style
【云原生】原来2020.0.X版本开始的OpenFeign底层不再使用Ribbon了
Traffic is not the most important thing for the metauniverse. Whether it can really change the traditional way of life and production is the most important
[daily question 1] 1184. Distance between bus stops
探讨影响自动化测试成败的重要因素
Cointegraph wrote: relying on the largest Dao usdd to become the most reliable stable currency
The income of bank financial management is getting lower and lower. Now which financial products have high income?
Decrypting numpy is a key difficulty in solving the gradient
vulnhub CyberSploit: 1
【每日一题】1184. 公交站间的距离
Thread 类的基本用法
Leave the factory and sell insurance
Save the sqoop run template