当前位置:网站首页>接口测试实战| GET/POST 请求区别详解
接口测试实战| GET/POST 请求区别详解
2022-04-22 16:12:00 【华为云】

1.请求行的 method 不同;
2.POST 可以附加 body,可以支持 form、json、xml、binary等各种数据格式;
3.从行业通用规范的角度来说,无状态变化的建议使用 GET 请求,数据的写入与状态建议用 POST 请求;
为了避免其他因素的干扰,使用 Flask 编写一个简单的 Demo Server。
4.安装flask
5.创建一个 hello.py 文件
hello.py
6.启动服务
提示下面信息则表示搭建成功。
发起 GET 请求,a、b参数放入 URL 中发送,并保存在 get 文件中:
发起 POST 请求,a、b参数以 form-data格式发送,并保存在post 文件中:
注意:>的右边为请求内容,<左边为响应内容。
GET 请求过程
POST 请求过程
对两个文件进行对比:
从图中可以清楚看到 GET 请求的 method 为 GET,POST 请求的 method 为 POST,此外,GET 请求没有 Content-Type 以及 Content-Length 这两个字段,而请求行中的 URL 带有 query 参数,是两种请求都允许的格式。
[原文链接](https://mp.weixin.qq.com/s?__biz=MzU3NDM4ODEzMg==&mid=2247487654&idx=1&sn=1fbd4486e1ffff0d6cefa61b91a9e9dd&chksm=fd32726dca45fb7b5883f6eff6dd400c63cb6f09abd20721171cd82be723ee57ad8c597f8a2e#rd)
版权声明
本文为[华为云]所创,转载请带上原文链接,感谢
https://bbs.huaweicloud.com/blogs/349130
边栏推荐
- 查询表中distinct 数据 数量 count mysql oracle 取指定条数
- 7-inch touch screen screen calibration parameter setting
- 短信平台API接口demo示例-Node/SMS/Send
- citespace安装和使用教程
- 类人猿手游内存技术教程
- Shiro customizes the cache and extends the Shiro cache module. You only need to configure the cache to realize session sharing
- C language insertion sort
- 343-Leetcode 反转字符串中的元音字母
- 396. Rotation function
- Three dimensional model of power conductor
猜你喜欢
![[b01lers2020]Life on Mars](/img/4c/c21f74153d6a668349d39f54e95e26.png)
[b01lers2020]Life on Mars

Servlet基础
![[experience sharing] Why is the green screen displayed after the video picture decoding fails?](/img/c3/e6f290ed781b948f010c84ee928b5c.png)
[experience sharing] Why is the green screen displayed after the video picture decoding fails?

Altium designer除了GND以外的Nets自动布线

343-Leetcode 反转字符串中的元音字母

从思维走向实践,数字化转型 IT 经营的成功路径

串口数据绘图SerialPlot的使用

1016 Phone Bills (25 分) 测试点1,2
![2022-4-21 [webrtc application] source code analysis of yangrtc / metartc open source library (III)](/img/a5/2e984494455d5a5127964fb49457d7.png)
2022-4-21 [webrtc application] source code analysis of yangrtc / metartc open source library (III)

MiniUSB管脚接口引脚定义
随机推荐
类人猿手游内存技术教程
Small exercise: binary search and Implementation
Vidéo hebdomadaire recommandée: comment reconstruire les compétences de base des entreprises à l'ère des stocks?
Abbexa丨4E-BP1 细胞 ELISA 试剂盒说明书
查询表中distinct 数据 数量 count mysql oracle 取指定条数
Servlet 的使用与对应的九个内置对象
Reference copy, deep copy, shallow copy
mobaXterm连接虚拟机后不能拖拽上传文件
ICMP and IPv6 global unicast address dynamic allocation
Servlet Foundation
谈谈TL431与AZ431代换通用问题(个人经验)
NFT platform security guide
4.21 summary
Immundiagnostik CRP(C反应蛋白)ELISA分析
An error is reported in the automatic database backup, indicating that SQLServerAgent is not currently running, so it cannot be notified of this operation.
All the goods in the files backed up by Taobao assistant were put on the shelves again
使用EasyGBS后更换为EasyCVR,更改端口为10000,报错404是什么原因?
Redis operation tool class based on jedis
Shiro customizes the cache and extends the Shiro cache module. You only need to configure the cache to realize session sharing
Abbexa丨3,5-二溴酪氨酸说明书
