aboutsummaryrefslogtreecommitdiffhomepage
path: root/caddytest
diff options
context:
space:
mode:
authorKévin Dunglas <[email protected]>2024-07-03 16:43:13 +0200
committerGitHub <[email protected]>2024-07-03 08:43:13 -0600
commit0287009ee5fbe171e7a84f7d5b965992bb5488a7 (patch)
tree44df6d0b10e5a6ab4f42b8658000d4b50e212b03 /caddytest
parentf8861ca16bd475e8519e7dbf5a2b55e81b329874 (diff)
downloadcaddy-0287009ee5fbe171e7a84f7d5b965992bb5488a7.tar.gz
caddy-0287009ee5fbe171e7a84f7d5b965992bb5488a7.zip
intercept: fix http.intercept.header.* placeholder (#6429)
Diffstat (limited to 'caddytest')
-rw-r--r--caddytest/integration/intercept_test.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/caddytest/integration/intercept_test.go b/caddytest/integration/intercept_test.go
index 81db6a7d6..6f8ffc929 100644
--- a/caddytest/integration/intercept_test.go
+++ b/caddytest/integration/intercept_test.go
@@ -18,17 +18,23 @@ func TestIntercept(t *testing.T) {
localhost:9080 {
respond /intercept "I'm a teapot" 408
+ header /intercept To-Intercept ok
respond /no-intercept "I'm not a teapot"
intercept {
@teapot status 408
handle_response @teapot {
+ header /intercept intercepted {resp.header.To-Intercept}
respond /intercept "I'm a combined coffee/tea pot that is temporarily out of coffee" 503
}
}
}
`, "caddyfile")
- tester.AssertGetResponse("http://localhost:9080/intercept", 503, "I'm a combined coffee/tea pot that is temporarily out of coffee")
+ r, _ := tester.AssertGetResponse("http://localhost:9080/intercept", 503, "I'm a combined coffee/tea pot that is temporarily out of coffee")
+ if r.Header.Get("intercepted") != "ok" {
+ t.Fatalf(`header "intercepted" value is not "ok": %s`, r.Header.Get("intercepted"))
+ }
+
tester.AssertGetResponse("http://localhost:9080/no-intercept", 200, "I'm not a teapot")
}