Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
test
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢昇
test
Commits
83cf56d2
Commit
83cf56d2
authored
Dec 12, 2018
by
谢昇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update API测试.md
parent
d30e6fb0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
API测试.md
API测试.md
+20
-6
No files found.
API测试.md
View file @
83cf56d2
# 一、H
TTP请求方式
# 一、H
TTP请求方式
...
...
@@ -18,7 +18,22 @@
对于
**GET**
来说,客户端与服务端的交互像是一个提问(如查询操作、搜索操作、读操作)
对于
**POST**
来说,有一下几种情况:
1.
交互是一个命令或订单(order),比提问包含更多信息
2.
交互改变了服务器端的资源并被用户察觉,例如订阅某项服务
3.
用户需要对交互产生的结果负责
\ No newline at end of file
对于
**POST**
来说,有以下几种情况:
1.
交互是一个命令或订单(order),比提问包含更多信息
2.
交互改变了服务器端的资源并被用户察觉,例如订阅某项服务
3.
用户需要对交互产生的结果负责
此外GET和POST还有一个比较大的区别,简单地说就是GET产生一个TCP数据包;POST产生两个TCP数据包。
对于GET方式的请求,浏览器会把http header和data一并发送出去,服务器响应200(返回数据);
而对于POST,浏览器先发送header,服务器响应100 continue,浏览器再发送data,服务器响应200 ok(返回数据)。
### HTTP状态码
对接口完成调用后,服务器会返回一个包含HTTP状态码的信息头(server header)用以响应该请求。
常见的状态码包括:
*
200 - 请求成功
*
301 - 资源(网页等)被永久转移到其它URL
*
403 - 服务器理解请求客户端的请求,但是拒绝执行此请求
*
404 - 请求的资源(网页等)不存在
*
500 - 内部服务器错误
通过这个可以在API测试时加上对状态码的是否等于200的判断。
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment