Skip to content

Commit

Permalink
update internal_util.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Jing-ze committed Dec 26, 2024
1 parent d253259 commit 62078d8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions providers/internal_util → providers/internal_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,19 @@ func validateToken(ctx context.Context, p Provider, accessToken string, header h
endpoint = endpoint + "?" + params.Encode()
}
}
var headerArray [][2]string
for key, values := range header {
for _, value := range values {
headerArray = append(headerArray, [2]string{key, value})
}
}

client.Get(endpoint, headers, []byte{}, func(statusCode int, responseHeaders http.Header, responseBody []byte) {
client.Get(endpoint, headerArray, func(statusCode int, responseHeaders http.Header, responseBody []byte) {
util.Logger.Debugf("%d GET %s %s", statusCode, stripToken(endpoint), responseBody)
if statusCode == 200 {
callback()
} else {
util.SendError(fmt.Sprintf("token validation request failed: status %d - %s", result.StatusCode(), result.Body()), nil, http.StatusInternalServerError)
util.SendError(fmt.Sprintf("token validation request failed: status %d - %s", statusCode, responseBody), nil, http.StatusInternalServerError)
}
}, timeout)
return true, true
Expand Down

0 comments on commit 62078d8

Please sign in to comment.