当前位置:网站首页>The difference between query string, formdata and request payload
The difference between query string, formdata and request payload
2022-07-18 16:09:00 【Lu Rongtao】
In the development of front end and back-end separation projects , There must be front and rear end joint commissioning . At this time, there will be many problems . Such as : Whether the front end can find the back end ; Whether the front end uses the correct request method ; Whether the front end transmits the correct data to the back end ; Whether the back end responds to the front end with correct data, etc . If none of the above is a problem , Congratulations ! That's great !
There is always a gap between reality and ideal . The data transmitted from the current end to the back end is correct , But the back end is stunned and can't get it ? Oh , Oh my god . How could this happen ?
Why? ?
because , The data format of the front and back ends is different . namely : The data format transmitted from the front end to the back end does not match the way the back end receives data . The following mainly talks about the front end , namely : Only pay attention to the data format at the time of request .
1、 The address bar transmits data
1)、query string Parameters:
When the request mode is get when , The browser will use the query string to transfer data , namely :query string Parameters
Rules for querying strings : The request parameter uses URL Address and “ Question mark and reference “ The way to deliver ---- Put a question mark on it url Separate from request parameters .
The format of the request parameter : In the form of key value pairs , Use... Between multiple key value pairs & separate .
hypothesis : Request address is newsList.php. The request parameter is pageIndex and pageCount.
that , The format of the request is :newsList.php?pageIndex=1&pageCount=10;
Here's the picture , The request method is get, stay chrome Browser's network What you see in the picture is :query string Parameters
2、 Data is transmitted in the request body
When the request mode is not get( Most of the time post or put) when , So the requested data is not in url On , It's in the request body . The English of request is :request payload. however chrome Browsers are designed for different content-type There is a distinction , Namely formData and request payload.
1)、formData
content-type The value of is " application/x-www-form-urlencoded" perhaps multipart/form-data; boundary=----WebKitFormBoundaryBoMA1XQDUpwpxKQg when , that , It's using formData Transfer data in the same format 

2)、request payload
content-type The value of is " text/plain" perhaps "application/json" when , that , It's using request payload Transfer data in the same format 

attach : Default data format :
1、 Conventional ajax When you ask ,Content-Type The default is " Text " type .
2、 Conventional form At the time of submission ,Content-Type The default is "Form" type ( application/x-www-form-urlencoded )
3、axios When passing strings ,Content-Type The default is "Form" type ( application/x-www-form-urlencoded )
4、axios When passing objects ,Content-Type The default is "JSON" type (( application/json)
* Lu Rongtao front-end learning exchange Q Group 858752519
Add group notes :CSDN recommend
边栏推荐
- EasyExcel的Converter注册问题
- 高等数学---第八章隐函数偏导数与全微分
- HCIP - PPP/HDLC与GRE/MGRE实验
- What does SPK interface mean
- 7.14二分,LCA,差分,思维构造
- Excellent open source attack and defense weapon project of the whole network
- Joint Autoregressive and Hierarchical Priors for Learned Image Compression文献复现
- 学习笔记——直流电机调速器
- 自定义类型下(枚举、联合)C语言
- NFT trading platform competition pattern: what is the core competitiveness?
猜你喜欢

Defi中的关键 智能合约是什么?

Fosai biology interprets the changes in the atmospheric environment in the first half of 2022, and VOCs control is still the key to breaking the situation

NFT players' consensus segmentation: money, community and culture

ReFi夏季升温:Uniswap v3和绿色资产池在Celo上启动

高等数学---第八章隐函数偏导数与全微分

Take Celsius as a negative textbook to teach you how to judge the quality of products and avoid investment risks

HCIP PPP/HDLC、GRE/MGRE实验

ValueError: The number of FixedLocator locations (7), usually from a call to set_ticks, does not mat

全面解析NFT的流动性问题与解决方案

7.13学习记录
随机推荐
Graphic array calculation module numpy (trigonometric function, rounding function, converting radian to angle, statistical analysis function, median, array sorting, argsort(), lexport())
1388.3n pizza dynamic planning
为健康增值,为时代赋能|仙乐健康发布年度可持续发展报告
Sqoop imports JSON format Chinese garbled code from MySQL
Sword finger offer 46: Translate numbers into strings
Kubedm install kubernetes 1.15 best practices
面试问到加密接口 如何测试 怎么解密 该怎么回答呢
ELK集群部署(七)之ELK集群启动顺序
HCIP PPP/HDLC、GRE/MGRE实验
RSS上手教程:聚合自己的信息收集渠道,RSSHub、FreshRSS、NetNewsWire
How to extract value from the working capital pool by using impermanent losses
华为机试:打印任务排序
Load balancing LVS cluster details
Chapter3美国大选金献项目数据分析
Tutorial on the principle and application of database system (019) -- MySQL configuration file
7.14 dichotomy, LCA, difference, thinking structure
Autojs learning - sound transformer template
容器健康检查解析
7.14二分,LCA,差分,思维构造
ValueError: The number of FixedLocator locations (7), usually from a call to set_ ticks, does not mat