improvements, fixes, update to go 1.16 #16

Merged
xdrm-brackets merged 7 commits from refactor/go1.16 into 0.3.0 2021-03-28 17:44:59 +00:00
1 changed files with 8 additions and 0 deletions
Showing only changes of commit 11aa9f0a0f - Show all commits

View File

@ -1,6 +1,7 @@
package aicra
import (
"log"
"net/http"
"git.xdrm.io/go/aicra/api"
@ -13,6 +14,13 @@ type Handler Builder
// ServeHTTP implements http.Handler
func (s Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
defer func() {
if rc := recover(); rc != nil {
log.Printf("recovering request: %s\n", rc)
// try to send error response
api.EmptyResponse().WithError(api.ErrUncallableService).ServeHTTP(w, r)
}
}()
defer r.Body.Close()
// 1. find a matching service from config