File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
caddytest/spec/http/basicauth Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Configure Caddy
2
+ POST http://localhost:2019/load
3
+ Content-Type: text/caddyfile
4
+ ```
5
+ {
6
+ skip_install_trust
7
+ http_port 9080
8
+ https_port 9443
9
+ local_certs
10
+ debug
11
+ }
12
+ localhost {
13
+ log
14
+ basic_auth {
15
+ john $2a$14$x4HlYwA9Zeer4RkMEYbUzug9XxWmncneR.dcMs.UjalR95URnHg5.
16
+ }
17
+ respond "Hello, World!"
18
+ }
19
+ ```
20
+
21
+ # requests without `Authorization` header are rejected with 401
22
+ GET https://localhost:9443
23
+ [Options]
24
+ insecure: true
25
+ HTTP 401
26
+ [Asserts]
27
+ header "WWW-Authenticate" == "Basic realm=\"restricted\""
28
+
29
+
30
+ # requests with `Authorization` header are accepted with 200
31
+ GET https://localhost:9443
32
+ [BasicAuth]
33
+ john:password
34
+ [Options]
35
+ insecure: true
36
+ HTTP 200
37
+ [Asserts]
38
+ `Hello, World!`
You can’t perform that action at this time.
0 commit comments