diff options
Diffstat (limited to 'caddyconfig')
-rwxr-xr-x | caddyconfig/caddyfile/parse_test.go | 2 | ||||
-rw-r--r-- | caddyconfig/httpcaddyfile/builtins.go | 10 | ||||
-rw-r--r-- | caddyconfig/httpcaddyfile/directives.go | 3 |
3 files changed, 11 insertions, 4 deletions
diff --git a/caddyconfig/caddyfile/parse_test.go b/caddyconfig/caddyfile/parse_test.go index d4e22cc..0168cfa 100755 --- a/caddyconfig/caddyfile/parse_test.go +++ b/caddyconfig/caddyfile/parse_test.go @@ -22,8 +22,6 @@ import ( "testing" ) -// TODO: re-enable all tests - func TestAllTokens(t *testing.T) { input := strings.NewReader("a b c\nd e") expected := []string{"a", "b", "c", "d", "e"} diff --git a/caddyconfig/httpcaddyfile/builtins.go b/caddyconfig/httpcaddyfile/builtins.go index 0ac436e..ff93b11 100644 --- a/caddyconfig/httpcaddyfile/builtins.go +++ b/caddyconfig/httpcaddyfile/builtins.go @@ -31,6 +31,7 @@ func init() { RegisterDirective("root", parseRoot) RegisterDirective("tls", parseTLS) RegisterHandlerDirective("redir", parseRedir) + RegisterHandlerDirective("respond", parseRespond) } func parseBind(h Helper) ([]ConfigValue, error) { @@ -253,3 +254,12 @@ func parseRedir(h Helper) (caddyhttp.MiddlewareHandler, error) { Body: body, }, nil } + +func parseRespond(h Helper) (caddyhttp.MiddlewareHandler, error) { + sr := new(caddyhttp.StaticResponse) + err := sr.UnmarshalCaddyfile(h.Dispenser) + if err != nil { + return nil, err + } + return sr, nil +} diff --git a/caddyconfig/httpcaddyfile/directives.go b/caddyconfig/httpcaddyfile/directives.go index 14c5f44..2f89f6d 100644 --- a/caddyconfig/httpcaddyfile/directives.go +++ b/caddyconfig/httpcaddyfile/directives.go @@ -25,7 +25,6 @@ import ( // defaultDirectiveOrder specifies the order // to apply directives in HTTP routes. -// TODO: finish the ability to customize this var defaultDirectiveOrder = []string{ "rewrite", "try_files", @@ -34,7 +33,7 @@ var defaultDirectiveOrder = []string{ "encode", "templates", "redir", - "static_response", // TODO: "reply" or "respond"? + "respond", "reverse_proxy", "php_fastcgi", "file_server", |