From 6554db3e5fb4a9d43441dec823687ffeca0498b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 23 Jul 2019 21:38:10 +0200 Subject: [PATCH] auth: Addres review --- lib/auth/handler.go | 2 +- lib/jsonrpc/client.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/auth/handler.go b/lib/auth/handler.go index 799914cc4..3ce40e983 100644 --- a/lib/auth/handler.go +++ b/lib/auth/handler.go @@ -26,7 +26,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.WriteHeader(401) return } - token = token[len("Bearer "):] + token = strings.TrimPrefix(token, "Bearer ") allow, err := h.Verify(ctx, token) if err != nil { diff --git a/lib/jsonrpc/client.go b/lib/jsonrpc/client.go index 074bb0d6d..aff8db320 100644 --- a/lib/jsonrpc/client.go +++ b/lib/jsonrpc/client.go @@ -56,7 +56,7 @@ type ClientCloser func() // NewClient creates new josnrpc 2.0 client // // handler must be pointer to a struct with function fields -// Returned value closes the client connectionnil +// Returned value closes the client connection // TODO: Example func NewClient(addr string, namespace string, handler interface{}, requestHeader http.Header) (ClientCloser, error) { htyp := reflect.TypeOf(handler)