Only check when access_token is available
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2019-08-17 19:44:08 +02:00
parent a6dde44d56
commit c232fbc828
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -63,8 +63,10 @@ func WithAuth(handler http.Handler, b *memoryBackend) http.Handler {
authorization := ""
if r.Method == http.MethodGet && r.URL.Query().Get("action") == "events" {
authorization = "Bearer " + r.URL.Query().Get("access_token")
values := r.URL.Query()
if r.Method == http.MethodGet && values.Get("action") == "events" && values.Get("access_token") != "" {
authorization = "Bearer " + values.Get("access_token")
} else {
authorization = r.Header.Get("Authorization")
}