forked from remote/oauth2
internal: inline CondVal function
Change-Id: Ic1115ab639e2d7b499c3400b5310575a36b1b796 Reviewed-on: https://go-review.googlesource.com/85320 Reviewed-by: Tim Cooper <tim.cooper@layeh.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
@@ -82,7 +82,9 @@ type tokenSource struct {
|
||||
func (c *tokenSource) Token() (*oauth2.Token, error) {
|
||||
v := url.Values{
|
||||
"grant_type": {"client_credentials"},
|
||||
"scope": internal.CondVal(strings.Join(c.conf.Scopes, " ")),
|
||||
}
|
||||
if len(c.conf.Scopes) > 0 {
|
||||
v.Set("scope", strings.Join(c.conf.Scopes, " "))
|
||||
}
|
||||
for k, p := range c.conf.EndpointParams {
|
||||
if _, ok := v[k]; ok {
|
||||
|
||||
Reference in New Issue
Block a user