mirror of
https://github.com/caddyserver/caddy.git
synced 2026-07-30 17:07:36 -04:00
intercept: fix misleading handle_response error for extra matcher args (#7871)
Same obsolete two-argument check as the reverse_proxy one removed in #7869: it referenced the long-removed inline status-code-replacement syntax and pointed users at replace_status even when no status replacement was involved. The generic check now rejects all excess-argument cases with an accurate message. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
localhost:8884 {
|
||||
intercept {
|
||||
handle_response header Foo {
|
||||
respond "handled"
|
||||
}
|
||||
}
|
||||
respond "hello"
|
||||
}
|
||||
|
||||
----------
|
||||
parsing caddyfile tokens for 'intercept': too many arguments for 'handle_response': only a single response matcher name is allowed, but got: [header Foo]
|
||||
@@ -303,13 +303,8 @@ func (i *Intercept) FinalizeUnmarshalCaddyfile(helper httpcaddyfile.Helper) erro
|
||||
d.Next()
|
||||
args := d.RemainingArgs()
|
||||
|
||||
// TODO: Remove this check at some point in the future
|
||||
if len(args) == 2 {
|
||||
return d.Errf("configuring 'handle_response' for status code replacement is no longer supported. Use 'replace_status' instead.")
|
||||
}
|
||||
|
||||
if len(args) > 1 {
|
||||
return d.Errf("too many arguments for 'handle_response': %s", args)
|
||||
return d.Errf("too many arguments for 'handle_response': only a single response matcher name is allowed, but got: %s", args)
|
||||
}
|
||||
|
||||
var matcher *caddyhttp.ResponseMatcher
|
||||
|
||||
Reference in New Issue
Block a user