fix: remove recoverer and body closer; must be users' responsability

This commit is contained in:
Adrien Marquès 2021-04-18 17:53:53 +02:00
parent 14ae59561c
commit 3986f7a022
1 changed files with 0 additions and 10 deletions

View File

@ -1,7 +1,6 @@
package aicra package aicra
import ( import (
"log"
"net/http" "net/http"
"git.xdrm.io/go/aicra/api" "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) { 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 // 1. find a matching service from config
var service = s.conf.Find(r) var service = s.conf.Find(r)
if service == nil { if service == nil {