-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapitest.http
38 lines (31 loc) · 1.38 KB
/
apitest.http
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
### Post user
POST http://0.0.0.0:8080/user?username=user11&[email protected]
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 201, "Response status is not 201");
});
client.test("Response content-type is json", function() {
const type = response.contentType.mimeType;
client.assert(type === "application/json", "Expected 'application/json' but received '" + type + "'");
});
client.test("Response contains correct information", function() {
client.assert(response.body.id != null, "id value is null or undefined");
client.assert(response.body.username === "user11", "Unexpected username value");
client.assert(response.body.email === "[email protected]", "Unexpected email value");
});
%}
### Get user
GET http://0.0.0.0:8080/user?id=16
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
client.test("Response content-type is json", function() {
const type = response.contentType.mimeType;
client.assert(type === "application/json", "Expected 'application/json' but received '" + type + "'");
});
client.test("Response contains correct information", function() {
client.assert(response.body.username === "user11", "Unexpected username value");
client.assert(response.body.email === "[email protected]", "Unexpected email value");
});
%}