combine native and micro http handlers

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2022-01-23 02:00:15 +03:00
parent 6714e48f4f
commit 31e996fc2e
3 changed files with 15 additions and 4 deletions

View File

@@ -124,7 +124,12 @@ func (h *httpServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
}
if !match {
if !match && h.hd != nil {
if hdlr, ok := h.hd.Handler().(http.Handler); ok {
hdlr.ServeHTTP(w, r)
return
}
} else if !match {
h.errorHandler(ctx, nil, w, r, fmt.Errorf("not matching route found"), http.StatusNotFound)
return
}