Skip to content

Commit

Permalink
fix(idtoken): Allow missing age in http response header (#1715)
Browse files Browse the repository at this point in the history
Per https://togithub.com/googleapis/google-api-go-client/issues/1711 allow the "age" field to be missing from the http response header file and treat it as a zero if it is missing.
  • Loading branch information
eytankidron authored Oct 18, 2022
1 parent f990a2a commit b235b1f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion idtoken/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ func (c *cachingClient) calculateExpireTime(headers http.Header) time.Time {
maxAge = ma
}
}
age, err := strconv.Atoi(headers.Get("age"))
a := headers.Get("age")
if a == "" {
return c.now().Add(time.Duration(maxAge) * time.Second)
}
age, err := strconv.Atoi(a)
if err != nil {
return c.now()
}
Expand Down

0 comments on commit b235b1f

Please sign in to comment.