Commit e77b75ec6c3e2651a1a4a311a193f0b2ef8c2a8e
1 parent
ea858b8a7b
Exists in
master
and in
1 other branch
proper LIKE formating
Showing
2 changed files
with
3 additions
and
4 deletions
Show diff stats
format_utility.go
http_utility.go
... | ... | @@ -49,10 +49,9 @@ func UnauthorizedResponse(w http.ResponseWriter, req *http.Request) { |
49 | 49 | }) |
50 | 50 | } |
51 | 51 | |
52 | -// TODO: Add parameters to enable/disable roles authorization checks | |
53 | 52 | // TODO: Check for content type |
54 | 53 | // Sets common headers and checks for token validity. |
55 | -func WrapHandler(handlerFunc http.HandlerFunc, needauth bool) http.HandlerFunc { | |
54 | +func WrapHandler(handlerFunc http.HandlerFunc, auth bool) http.HandlerFunc { | |
56 | 55 | return func(w http.ResponseWriter, req *http.Request) { |
57 | 56 | w.Header().Set("Access-Control-Allow-Origin", "*") |
58 | 57 | |
... | ... | @@ -69,7 +68,7 @@ func WrapHandler(handlerFunc http.HandlerFunc, needauth bool) http.HandlerFunc { |
69 | 68 | return |
70 | 69 | } |
71 | 70 | |
72 | - if needauth { | |
71 | + if auth { | |
73 | 72 | token := req.Header.Get("Authorization") |
74 | 73 | if _, err := ParseAPIToken(token); err != nil { |
75 | 74 | UnauthorizedResponse(w, req) | ... | ... |