当前位置:网站首页>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 ‘_'
边栏推荐
- Codeforces - 1324d pair of topics
- [Frida practice] "one line" code teaches you to obtain all Lua scripts in wegame platform
- Introduction to automated testing framework
- Sqlplus garbled code problem, find the solution
- Addition, deletion, modification and query of ThinkPHP database
- Introduction to energy Router: Architecture and functions for energy Internet
- Become a "founder" and make reading a habit
- web3.0系列之分布式存储IPFS
- C# 初始化程序时查看初始化到哪里了示例
- Win10安装VS2015
猜你喜欢
CentOS installs JDK1.8 and mysql5 and 8 (the same command 58 in the second installation mode is common, opening access rights and changing passwords)
Internship log - day07
企业实战|复杂业务关系下的银行业运维指标体系建设
Natapp intranet penetration
内存==c语言1
ES类和对象、原型
The new activity of "the arrival of twelve constellations and goddesses" was launched
Arcgis操作: 批量修改属性表
“十二星座女神降临”全新活动推出
反卷积通俗详细解析与nn.ConvTranspose2d重要参数解释
随机推荐
Pit using BigDecimal
The new activity of "the arrival of twelve constellations and goddesses" was launched
Bit operation ==c language 2
20排位赛3
【ORM框架】
喜马拉雅网页版每次暂停后弹窗推荐下载客户端解决办法
运用tensorflow中的keras搭建卷积神经网络
Internship log - day04
一大波开源小抄来袭
The applet realizes multi-level page switching back and forth, and supports sliding and clicking operations
Natapp intranet penetration
Pit encountered by vs2015 under win7 (successful)
洛谷P2482 [SDOI2010]猪国杀
ORM model -- associated fields, abstract model classes
Switching value signal anti shake FB of PLC signal processing series
Why are social portals rarely provided in real estate o2o applications?
2016 CCPC Hangzhou Onsite
Do you have a boss to help look at this error report and what troubleshooting ideas are there? Oracle CDC 2.2.1 flick 1.14.4
Three years after graduation
Some thoughts on the testing work in the process of R & D