test dynfunc package; standardize and refactor api #14

Merged
xdrm-brackets merged 19 commits from test/dynamic into 0.3.0 2020-04-04 10:09:20 +00:00
2 changed files with 0 additions and 16 deletions
Showing only changes of commit 92da498d49 - Show all commits

View File

@ -73,7 +73,6 @@ func errorHandler(err api.Error) http.HandlerFunc {
return func(res http.ResponseWriter, req *http.Request) { return func(res http.ResponseWriter, req *http.Request) {
r := api.EmptyResponse().WithError(err) r := api.EmptyResponse().WithError(err)
r.ServeHTTP(res, req) r.ServeHTTP(res, req)
logError(r)
} }
} }

15
util.go
View File

@ -1,15 +0,0 @@
package aicra
import (
"log"
"net/http"
"git.xdrm.io/go/aicra/api"
)
var handledMethods = []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete}
// Prints an error as HTTP response
func logError(res *api.Response) {
log.Printf("[http.fail] %v\n", res)
}