aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/dashapi/dashapi.go
diff options
context:
space:
mode:
Diffstat (limited to 'dashboard/dashapi/dashapi.go')
-rw-r--r--dashboard/dashapi/dashapi.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go
index 14fa44faa..a78e25073 100644
--- a/dashboard/dashapi/dashapi.go
+++ b/dashboard/dashapi/dashapi.go
@@ -53,12 +53,12 @@ func NewCustom(client, addr, key string, ctor RequestCtor, doer RequestDoer,
return nil, err
}
wrappedDoer = func(req *http.Request) (*http.Response, error) {
- if token, err := tokenCache.Get(time.Now()); err == nil {
- req.Header.Add("Authorization", "Bearer "+token)
- return doer(req)
- } else {
+ token, err := tokenCache.Get(time.Now())
+ if err != nil {
return nil, err
}
+ req.Header.Add("Authorization", token)
+ return doer(req)
}
}
return &Dashboard{