aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-13 02:49:13 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-13 02:49:13 -0400
commit6f72a024fa0cb49022bd91c0a6a08d7b9f78767d (patch)
tree018319078391abbdc53c6eda4f4043b65ab68497 /pkg
parent4999ad031c0d96635c0669d4827188fdf64192f8 (diff)
downloadAtlas-6f72a024fa0cb49022bd91c0a6a08d7b9f78767d.tar.gz
Atlas-6f72a024fa0cb49022bd91c0a6a08d7b9f78767d.zip
pkg/api/api0: Add NotFound handler
Diffstat (limited to 'pkg')
-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)
+ }
}
}