refactor HTTP error.

This commit is contained in:
Miroslav Šedivý 2021-09-16 20:16:51 +02:00
parent d46c5d9d30
commit 4fa11e6a2a
15 changed files with 166 additions and 102 deletions

View file

@ -13,7 +13,6 @@ import (
"demodesk/neko/internal/config"
"demodesk/neko/internal/types"
"demodesk/neko/internal/utils"
)
type HttpManagerCtx struct {
@ -55,13 +54,13 @@ func New(WebSocketManager types.WebSocketManager, ApiManager types.ApiManager, c
if _, err := os.Stat(config.Static + r.URL.Path); !os.IsNotExist(err) {
fs.ServeHTTP(w, r)
} else {
utils.HttpNotFound(w)
http.NotFound(w, r)
}
})
}
router.NotFound(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
utils.HttpNotFound(w)
http.NotFound(w, r)
}))
return &HttpManagerCtx{