-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequests.http
More file actions
58 lines (47 loc) · 1.52 KB
/
requests.http
File metadata and controls
58 lines (47 loc) · 1.52 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
@port=8080
### GET Проверка на живучесть
GET http://127.0.0.1:{{port}}/healthcheck
Accept: application/json
> {%
client.test("Successful", function () {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### POST Создание пользователя
POST http://127.0.0.1:{{port}}/users
Content-Type: application/json;charset=utf-8
{
"username": "{{$random.name.username}}",
"password": "12345",
"role": "user"
}
> {%
let resource_location = response.headers.valueOf("Location");
client.global.set("created_user_uri", resource_location)
client.global.set("created_user_id", response.headers.valueOf("X-User-ID"))
client.test("Successful", function () {
client.assert(response.status === 201, "Response status is not 201");
});
console.log("Location: " + resource_location)
%}
### GET Получение ранее созданного пользователя
GET {{created_user_uri}}
Accept: application/json
> {%
client.test("Successful", function () {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### GRPC Получение пользователя по ID
GRPC grpc://127.0.0.1:31002/users.Service/GetUser
{
"user_id": "{{created_user_id}}"
}
### DELETE Удаляем пользователя
DELETE {{created_user_uri}}
Accept: application/json
> {%
client.test("Successful", function () {
client.assert(response.status === 204, "Response status is not 204");
});
%}