-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest.http
More file actions
70 lines (55 loc) · 1.5 KB
/
Copy pathrequest.http
File metadata and controls
70 lines (55 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# 本地环境api
@baseUrl = http://localhost:3001/api/v1
# 线上环境api
# @baseUrl = http://8.130.142.163:3001/api/v1
@apiKey = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwibmFtZSI6ImFkbWluIiwiZW1haWwiOiIxMzU2NjEwNjM5OUAxNjMuY29tIiwicGFzc3dvcmQiOiIxMjM0NTYiLCJpYXQiOjE3NDQzNzAzNTcsImV4cCI6MTc0NDk3NTE1N30.JlmSu9mrHHaJM_VmzlonsCewgxwAmQ6s4YzwPF5EB8c
### 用户列表
GET {{baseUrl}}/user/index HTTP/1.1
Authorization: Bearer {{apiKey}}
### 注册
POST {{baseUrl}}/user/register HTTP/1.1
Content-Type: application/json
{
"email": "13566106399@163.com",
"password": "123456",
"name": "admin"
}
### 登录
POST {{baseUrl}}/user/login HTTP/1.1
Content-Type: application/json
{
"email": "13566106399@163.com",
"password": "123456"
}
### 删除用户
DELETE {{baseUrl}}/user/del/2 HTTP/1.1
### 添加文章
POST {{baseUrl}}/post/create HTTP/1.1
Content-Type: application/json
Authorization: Bearer {{apiKey}}
{
"title": "充满希望的一天",
"publish": false
}
### 测试 XHR 错误处理 (模拟 AJAX 请求)
GET {{baseUrl}}/user/test-error
X-Requested-With: XMLHttpRequest
### 测试普通请求错误处理
GET {{baseUrl}}/user/test-error
### 测试 JSON 格式错误
POST {{baseUrl}}/users
Content-Type: application/json
{
"name": "test",
invalid json format
}
### 项目列表
GET {{baseUrl}}/project/list HTTP/1.1
Authorization: Bearer {{apiKey}}
### 项目创建
POST {{baseUrl}}/project/create HTTP/1.1
Authorization: Bearer {{apiKey}}
{
"name": "中华小当家",
"status": "IN_PROGRESS"
}