aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/api0
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api/api0')
-rw-r--r--pkg/api/api0/api.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/api/api0/api.go b/pkg/api/api0/api.go
index 40aa90b..fe869af 100644
--- a/pkg/api/api0/api.go
+++ b/pkg/api/api0/api.go
@@ -20,6 +20,7 @@ import (
type Handler struct {
PdataStorage PdataStorage
+ NotFound http.Handler
}
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
@@ -29,10 +30,12 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
case strings.HasPrefix(r.URL.Path, "/player/"):
// TODO: rate limit
h.handlePlayer(w, r)
- return
default:
- http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
- return
+ if h.NotFound == nil {
+ http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
+ } else {
+ h.NotFound.ServeHTTP(w, r)
+ }
}
}