-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbasic_auth.txt
More file actions
41 lines (39 loc) · 1.14 KB
/
basic_auth.txt
File metadata and controls
41 lines (39 loc) · 1.14 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
serve hello.text user password
expand src_var.cel src.cel
cmpenv src.cel src_var.cel
mito -use http src.cel
! stderr .
cmp stdout want.txt
-- hello.text --
hello
-- src_var.cel --
// $URL is set by the serve command and ${URL} is expanded by the expand command.
{
"request": request("GET", "http://www.example.com/").basic_authentication("username", "password"),
"no_auth": string(request("GET", "${URL}").do_request().Body),
"mismatch_user": string(request("GET", "${URL}").basic_authentication("", "").do_request().Body),
"mismatch_pass": string(request("GET", "${URL}").basic_authentication("user", "").do_request().Body),
"matched": string(request("GET", "${URL}").basic_authentication("user", "password").do_request().Body),
}
-- want.txt --
{
"matched": "hello\n",
"mismatch_pass": "password mismatch",
"mismatch_user": "user mismatch",
"no_auth": "user mismatch",
"request": {
"Close": false,
"ContentLength": 0,
"Header": {
"Authorization": [
"Basic dXNlcm5hbWU6cGFzc3dvcmQ="
]
},
"Host": "www.example.com",
"Method": "GET",
"Proto": "HTTP/1.1",
"ProtoMajor": 1,
"ProtoMinor": 1,
"URL": "http://www.example.com/"
}
}