aboutsummaryrefslogtreecommitdiff
path: root/handler.go
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-02-20 16:42:18 -0500
committerAdnan Maolood <[email protected]>2021-02-20 16:42:18 -0500
commit351fb92c7e9f66a52f5559b56085642e80214eb9 (patch)
tree95933e0751b89f9f910c7bb469c1c657fcf1d510 /handler.go
parentserver: Make Request.RemoteAddr a net.Addr (diff)
downloadgo-gemini-351fb92c7e9f66a52f5559b56085642e80214eb9.tar.xz
go-gemini-351fb92c7e9f66a52f5559b56085642e80214eb9.zip
Remove NotFound function
Diffstat (limited to 'handler.go')
-rw-r--r--handler.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/handler.go b/handler.go
index 5698e88..b3b2b23 100644
--- a/handler.go
+++ b/handler.go
@@ -53,15 +53,12 @@ func (h *redirectHandler) ServeGemini(ctx context.Context, w ResponseWriter, r *
w.WriteHeader(h.status, h.url)
}
-// NotFound replies to the request with a Gemini 51 not found error.
-func NotFound(ctx context.Context, w ResponseWriter, r *Request) {
- w.WriteHeader(StatusNotFound, "Not found")
-}
-
// NotFoundHandler returns a simple request handler that replies to each
// request with a “51 Not found” reply.
func NotFoundHandler() Handler {
- return HandlerFunc(NotFound)
+ return HandlerFunc(func(ctx context.Context, w ResponseWriter, r *Request) {
+ w.WriteHeader(StatusNotFound, "Not found")
+ })
}
// StripPrefix returns a handler that serves Gemini requests by removing the
@@ -86,7 +83,7 @@ func StripPrefix(prefix string, h Handler) Handler {
r2.URL.RawPath = rp
h.ServeGemini(ctx, w, r2)
} else {
- NotFound(ctx, w, r)
+ w.WriteHeader(StatusNotFound, "Not found")
}
})
}