当前位置:网站首页>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 ‘_'
边栏推荐
- Bean operation domain and life cycle
- Basic use of JMeter to proficiency (I) creation and testing of the first task thread from installation
- [learning notes - Li Hongyi] Gan (generation of confrontation network) full series (I)
- 位操作==c语言2
- 高数_第1章空间解析几何与向量代数_向量的数量积
- 2016 CCPC Hangzhou Onsite
- The Himalaya web version will pop up after each pause. It is recommended to download the client solution
- 内存==c语言1
- Main (argc, *argv[]) details
- Applet sliding, clicking and switching simple UI
猜你喜欢
Web3.0 series distributed storage IPFs
Deep understanding of UDP, TCP
企业实战|复杂业务关系下的银行业运维指标体系建设
ORM--查询类型,关联查询
Win10 installation vs2015
使用BigDecimal的坑
Google colab loads Google drive (Google drive is used in Google colab)
Internship log - day07
Use 3 in data modeling σ Eliminate outliers for data cleaning
Memory ==c language 1
随机推荐
Why does the starting service report an error when installing MySQL? (operating system Windows)
内存==c语言1
C# 初始化程序时查看初始化到哪里了示例
A wave of open source notebooks is coming
Using keras in tensorflow to build convolutional neural network
Analyze Android event distribution mechanism according to popular interview questions (II) -- event conflict analysis and handling
Agile course training
Introduction to automated testing framework
Thinkphp3.2 information disclosure
Bit operation ==c language 2
能源路由器入门必读:面向能源互联网的架构和功能
ORM模型--数据记录的创建操作,查询操作
HCIP 第一天 笔记整理
Win10安装VS2015
Future development blueprint of agriculture and animal husbandry -- vertical agriculture + artificial meat
CDZSC_2022寒假个人训练赛21级(1)
EXT2 file system
Enterprise practice | construction of banking operation and maintenance index system under complex business relations
Guys, have you ever encountered the case of losing data when Flink CDC reads mysqlbinlog? Every time the task restarts, there is a probability of losing data
Google colab loads Google drive (Google drive is used in Google colab)