summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-09-16 11:04:18 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-09-16 11:04:18 -0600
commitd030bfdae065c8776e8ac14c0a28f725ec05145c (patch)
tree722a4e4b11993e9eb23664d4e49e87df6c5aa9ed /modules
parentdb4c73dd58b496f2c0c49a38f6c8b5f525456e3e (diff)
httpcaddyfile: static_response -> respond; minor cleanups
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/encode/caddyfile.go3
-rw-r--r--modules/caddyhttp/staticresp.go10
2 files changed, 6 insertions, 7 deletions
diff --git a/modules/caddyhttp/encode/caddyfile.go b/modules/caddyhttp/encode/caddyfile.go
index d23eab9..2f0e151 100644
--- a/modules/caddyhttp/encode/caddyfile.go
+++ b/modules/caddyhttp/encode/caddyfile.go
@@ -29,7 +29,6 @@ func init() {
httpcaddyfile.RegisterHandlerDirective("encode", parseCaddyfile)
}
-// TODO: This is a good example of why UnmarshalCaddyfile is still a good idea... hmm.
func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) {
enc := new(Encode)
err := enc.UnmarshalCaddyfile(h.Dispenser)
@@ -39,8 +38,6 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
return enc, nil
}
-// TODO: Keep UnmarshalCaddyfile pattern?
-
// UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax:
//
// encode [<matcher>] <formats...> {
diff --git a/modules/caddyhttp/staticresp.go b/modules/caddyhttp/staticresp.go
index 21ff9d5..a435f87 100644
--- a/modules/caddyhttp/staticresp.go
+++ b/modules/caddyhttp/staticresp.go
@@ -25,7 +25,6 @@ import (
func init() {
caddy.RegisterModule(StaticResponse{})
- // TODO: Caddyfile directive
}
// StaticResponse implements a simple responder for static responses.
@@ -46,7 +45,7 @@ func (StaticResponse) CaddyModule() caddy.ModuleInfo {
// UnmarshalCaddyfile sets up the handler from Caddyfile tokens. Syntax:
//
-// static_response [<matcher>] <status> {
+// respond [<matcher>] <status> {
// body <text>
// close
// }
@@ -119,5 +118,8 @@ func (s StaticResponse) ServeHTTP(w http.ResponseWriter, r *http.Request, _ Hand
return nil
}
-// Interface guard
-var _ MiddlewareHandler = (*StaticResponse)(nil)
+// Interface guards
+var (
+ _ MiddlewareHandler = (*StaticResponse)(nil)
+ _ caddyfile.Unmarshaler = (*StaticResponse)(nil)
+)