Got it working!

This commit is contained in:
Daniel Ledda
2020-11-02 23:58:12 +01:00
parent 10523274b8
commit 856e8723aa

View File

@@ -67,13 +67,14 @@ var MainRouter = Router{make(map[string] *PatternRouter)}
func getPatternHandler(pattern string) http.HandlerFunc {
return func (w http.ResponseWriter, r *http.Request) {
cb, err := MainRouter.MethodFuncForPattern(HttpMethod(r.Method), pattern)
context := RequestContext{w, r, HttpMethod(r.Method), pattern}
if err == nil {
err = cb(w, r)
}
if err != nil {
context := RequestContext{w, r, HttpMethod(r.Method), pattern}
sendInternalError(err, context)
}
fmt.Println(context)
}
}