当前位置:网站首页>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 |
边栏推荐
- Restrict Su command and sudo mechanism to promote nmap and console command netstat
- [OBS] DTS sent by video packet_ USEC calculation
- Statistical learning -- naive Bayesian method
- 2022深圳杯
- error: redefinition of
- The relationship between Informatics, mathematics and Mathematical Olympiad (July 19, 2022) C
- 10分钟看懂Jmeter 是如何玩转 redis 数据库的
- 章鱼网络 Community Call #1|开启 Octopus DAO 构建
- [semidrive source code analysis] [drive bringup] 39 - touch panel touch screen debugging
- __ str__ Output class
猜你喜欢

【每日一题】1184. 公交站间的距离

Not only log collection, but also the installation, configuration and use of project monitoring tool sentry

Can interface debugging still play like this?

Basic usage of thread class

Leetcode skimming: dynamic programming 06 (integer splitting)

睡眠不足有哪些危害?

BOM概述

MySQL remote login

From the era of portal to the era of information flow, good content has been ignored?
![[yolov5 practice 3] traffic sign recognition system based on yolov5 - model training](/img/2f/1d2938dafa17c602c9aaf640be9bf1.png)
[yolov5 practice 3] traffic sign recognition system based on yolov5 - model training
随机推荐
【SemiDrive源码分析】【驱动BringUp】38 - NorFlash & eMMC分区配置
[knowledge summary] block and value range block
解密NumPy求解梯度的一个关键难点
QT6 with vs Code: compiling source code and basic configuration
2022 Shenzhen cup
vulnhub CyberSploit: 1
[OBS] DTS sent by video packet_ USEC calculation
Create a new STM32 project and configure it - based on registers
分布式爬虫中的增量爬虫
Default value of dart variable
Electronic Association C language level 2 60, integer parity sort (real question in June 2021)
Ant design input search box listens for allowclear event separately
What are the hazards of insufficient sleep?
QT actual combat case (53) -- using qdrag to realize the drag puzzle function
scrapy定时爬虫的思路
New tea, start "fighting in groups"
Restrict Su command and sudo mechanism to promote nmap and console command netstat
error: redefinition of
Can communication test based on STM32: turn the globe
Tab bar toggle style