diff --git a/caddytest/integration/caddyfile_adapt/intercept_handle_response_too_many_args.caddyfiletest b/caddytest/integration/caddyfile_adapt/intercept_handle_response_too_many_args.caddyfiletest new file mode 100644 index 000000000..ba3ef5655 --- /dev/null +++ b/caddytest/integration/caddyfile_adapt/intercept_handle_response_too_many_args.caddyfiletest @@ -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] diff --git a/modules/caddyhttp/intercept/intercept.go b/modules/caddyhttp/intercept/intercept.go index f0deb1b26..fc37be05b 100644 --- a/modules/caddyhttp/intercept/intercept.go +++ b/modules/caddyhttp/intercept/intercept.go @@ -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