-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.fan
More file actions
82 lines (68 loc) · 1.38 KB
/
test.fan
File metadata and controls
82 lines (68 loc) · 1.38 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
71
72
73
74
75
76
77
78
79
80
81
82
let host = "httpbingo.org";
rq get`
GET https://{host}/get
Host: {host}
Connection: close
`[status == 200]
rq post`
POST https://{host}/post
Host: {host}
Accept-Encoding: gzip, deflate
`[status == 200]
rq post`
POST https://{host}/post
Host: {host}
Accept-Encoding: gzip, deflate
`[status == 200]
rq postForm`
POST https://{host}/post
Host: {host}
Content-Type: application/x-www-form-urlencoded
a: b
`[status == 200]
rq postMultipart`
POST https://{host}/post
Host: {host}
Content-Type: multipart/form-data
a: b
f: @folder/text.txt
`[status == 200]
rq postJson`
POST https://{host}/post
Host: {host}
Content-Type: application/json
{
"name": "Gauss",
"age": 6,
"address": {
"street": "19 Hear Sea Street",
"city": "DaLian"
},
"phones": [
"+86 13098767890",
"+86 15876567890"
]
}
`[status == 200]
test get {
let response = get->;
response.status
}
test post {
let response = post->;
response.status
}
test postForm {
let response = postForm->;
let status = response.status
println("status: {status}")
}
test postMultipart {
let response = postMultipart->;
let body = response.body
println("body: {body}")
}
test postJson {
let response = postJson->;
response.status
}