fix: remove recoverer and body closer; must be users' responsability
This commit is contained in:
parent
14ae59561c
commit
3986f7a022
10
handler.go
10
handler.go
|
@ -1,7 +1,6 @@
|
|||
package aicra
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"git.xdrm.io/go/aicra/api"
|
||||
|
@ -23,15 +22,6 @@ func (s Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
func (s Handler) handleRequest(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
|
||||
var service = s.conf.Find(r)
|
||||
if service == nil {
|
||||
|
|
Loading…
Reference in New Issue