当前位置:网站首页>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 |
边栏推荐
- mvc与三层结构终极区别
- Rongyun launched a real-time community solution and launched "advanced players" for vertical interest social networking
- vulnhub CyberSploit: 1
- Wei Lai: what is the difference between multithreaded join and detach?
- Kubernates-1.24.2 (latest version) + containerd + nexus
- scrapy定时爬虫的思路
- Recycleview realizes horizontal sliding of overlapping items
- Not only log collection, but also the installation, configuration and use of project monitoring tool sentry
- 【每日一题】1184. 公交站间的距离
- Microorganisms are healthy. Don't exclude microorganisms in the human body
猜你喜欢

【电脑讲解】NVIDIA发布GeForce RTX SUPER系列显卡,游戏玩家福利来了!

论文阅读:UNET 3+: A FULL-SCALE CONNECTED UNET FOR MEDICAL IMAGE SEGMENTATION

Basic usage of thread class

Leave the factory and sell insurance

Upload and download multiple files using web APIs

Scavenging vultures or woodpeckers? How to correctly understand short selling

CTF Crypto---RSA KCS1_ Oaep mode

【terminal】x86 Native Tools Command Prompt for VS 2017

代码中的软件工程:正则表达式十步通关

Leetcode skimming: dynamic programming 06 (integer splitting)
随机推荐
【obs】视频包发送的dts_usec 计算
Basic usage of thread class
Lpad() function and (row_number() over (order by) +...)
列表推导式
分层强化学习综述:Hierarchical reinforcement learning: A comprehensive survey
【电脑讲解】去电脑维修店修电脑需要注意什么?
【刷题笔记】搜索旋转排序数组
ArgoCD 用户管理、RBAC 控制、脚本登录、App 同步
vulnhub CyberSploit: 1
蔚来一面:多线程join和detach的区别?
New tea, start "fighting in groups"
LeetCode46全排列(回溯入门)
YOLOv7模型推理和训练自己的数据集
微生物健康,不要排斥人体内微生物
[daily question] sword finger offer II 115. reconstruction sequence
File operation-
【SemiDrive源码分析】【驱动BringUp】39 - Touch Panel 触摸屏调试
如何学习 C 语言?
Example demonstration of math.random() random function
Purpose of SQL square brackets