当前位置:网站首页>The request object parses the request body and request header parameters
The request object parses the request body and request header parameters
2022-07-07 10:07:00 【chuntian_ tester】
1. Request body parameter resolution :
1.1 GET request
1.1.1 request url in /?xxx&xxx The format is query string parameter , adopt request.GET Get request parameters
1.1.2 request url in /xxx/2/xxx The format is path parameter , adopt request.GET obtain
1.1.3 url in xx/?name=aa&age=19&name=bb, adopt request.GET obtain , If you want to get all name Parameters , adopt getlist('key1') Get the same key Multiple values of , return list type
1.2 POS request
1.2.1 json Format requester parameters
json Format parameters will be stored in body in , It's usually bytes Byte type , Use json.loads(request.body) Extract parameters after processing

1.2.2 www-form-urlencoded Format parameters
Generally, the parameters entered through the form in the front end are www-form-urlencoded type , adopt request.POST obtain
1.2.3 file File type parameters
1.2.3.1 adopt form-data Medium file Type parameter
content_type The type is multipart/form-data, Parameter from request.body In order to get

1.2.3.2 adopt binary Medium file Type parameter
Pure file , Use both request.body obtain
2. Request header parameter parsing :

2.1 request.headers['key'] perhaps request.headers.get('key') obtain

2.2 request.META['HTTP_AUTHORIZATION'] obtain
The request header parameter will be converted to :HTTP_ Parameter names are capitalized , If there is ‘-’ Symbol , Will automatically convert to ‘_'

边栏推荐
- Internship log - day07
- Deadlock caused by non clustered index in SQL Server
- Scratch crawler mysql, Django, etc
- 剑指 Offer II 107. 矩阵中的距离
- Guys, how can mysql-cdc convert the upsert message to append only
- 虚数j的物理意义
- China's first electronic audio category "Yamano electronic audio" digital collection is on sale!
- Arcgis操作: 批量修改属性表
- arcgis操作:dwg数据转为shp数据
- CDZSC_2022寒假个人训练赛21级(2)
猜你喜欢

Applet popup half angle mask layer

EXT2 file system

AI moves from perception to intelligent cognition

ES类和对象、原型

喜马拉雅网页版每次暂停后弹窗推荐下载客户端解决办法

Bean operation domain and life cycle

Natapp intranet penetration

Software modeling and analysis

Some thoughts on the testing work in the process of R & D

反卷积通俗详细解析与nn.ConvTranspose2d重要参数解释
随机推荐
CDZSC_2022寒假个人训练赛21级(2)
VS Code指定扩展安装位置
“十二星座女神降临”全新活动推出
小程序实现页面多级来回切换支持滑动和点击操作
终于可以一行代码也不用改了!ShardingSphere 原生驱动问世
Three years after graduation
Gym - 102219j kitchen plates (violent or topological sequence)
内存==c语言1
【学习笔记-李宏毅】GAN(生成对抗网络)全系列(一)
Hcip first day notes sorting
有没有大佬帮忙看看这个报错,有啥排查思路,oracle cdc 2.2.1 flink 1.14.4
大佬们,请问 MySQL-CDC 有什么办法将 upsert 消息转换为 append only 消
Win10 installation vs2015
Bean operation domain and life cycle
Analyze Android event distribution mechanism according to popular interview questions (I)
小程序滑动、点击切换简洁UI
一大波开源小抄来袭
2020ccpc Weihai J - Steins; Game (SG function, linear basis)
EXT2 file system
ORM model -- associated fields, abstract model classes