fix http error handlers

This commit is contained in:
Adrien Marquès 2020-04-04 16:03:12 +02:00
parent 30862195a1
commit d198086dd4
Signed by: xdrm-brackets
GPG Key ID: D75243CA236D825E
1 changed files with 3 additions and 3 deletions

View File

@ -18,14 +18,14 @@ func (server Server) ServeHTTP(res http.ResponseWriter, req *http.Request) {
// 1. find a matching service in the config // 1. find a matching service in the config
service := server.conf.Find(req) service := server.conf.Find(req)
if service == nil { if service == nil {
errorHandler(api.ErrorUnknownService) errorHandler(api.ErrorUnknownService).ServeHTTP(res, req)
return return
} }
// 2. extract request data // 2. extract request data
dataset, err := extractRequestData(service, *req) dataset, err := extractRequestData(service, *req)
if err != nil { if err != nil {
errorHandler(api.ErrorMissingParam) errorHandler(api.ErrorMissingParam).ServeHTTP(res, req)
return return
} }
@ -39,7 +39,7 @@ func (server Server) ServeHTTP(res http.ResponseWriter, req *http.Request) {
// 4. fail if found no handler // 4. fail if found no handler
if handler == nil { if handler == nil {
errorHandler(api.ErrorUncallableService) errorHandler(api.ErrorUncallableService).ServeHTTP(res, req)
return return
} }