mirror of
https://github.com/sigmasternchen/threadule
synced 2025-03-15 08:09:01 +00:00
added not found and method not allowed handler for debugging
This commit is contained in:
parent
d122924fde
commit
bd726f484d
2 changed files with 11 additions and 0 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
func ctxWrapper(appCtx *app.Context, handler web.Handler) httprouter.Handle {
|
||||
return func(writer http.ResponseWriter, request *http.Request, params httprouter.Params) {
|
||||
writer.Header().Add("Content-Type", "application/json")
|
||||
|
||||
start := time.Now()
|
||||
handler(&web.Context{
|
||||
Response: writer,
|
||||
|
|
|
@ -10,6 +10,16 @@ import (
|
|||
func Setup(ctx *app.Context) http.Handler {
|
||||
router := &router{Router: httprouter.New(), appCtx: ctx}
|
||||
|
||||
router.NotFound = http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
|
||||
ctx.AccessLog.Printf("%s %s; not found", request.Method, request.URL.String())
|
||||
writer.WriteHeader(http.StatusNotFound)
|
||||
})
|
||||
|
||||
router.MethodNotAllowed = http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
|
||||
ctx.AccessLog.Printf("%s %s; method not allowed", request.Method, request.URL.String())
|
||||
writer.WriteHeader(http.StatusMethodNotAllowed)
|
||||
})
|
||||
|
||||
router.POST("/authentication", Login)
|
||||
router.GET("/authentication", authenticated(GetAuthenticationData))
|
||||
|
||||
|
|
Loading…
Reference in a new issue