File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -249,12 +249,20 @@ func (c *clientCreator) NewInstallationV4Client(installationID int64) (*githubv4
249
249
func (c * clientCreator ) NewTokenClient (token string ) (* github.Client , error ) {
250
250
ts := oauth2 .StaticTokenSource (& oauth2.Token {AccessToken : token })
251
251
tc := oauth2 .NewClient (context .Background (), ts )
252
- return c .newClient (tc , nil , "oauth token" , 0 )
252
+
253
+ middleware := []ClientMiddleware {}
254
+ if c .cacheFunc != nil {
255
+ middleware = append (middleware , cache (c .cacheFunc ), cacheControl (c .alwaysValidate ))
256
+ }
257
+
258
+ return c .newClient (tc , middleware , "oauth token" , 0 )
253
259
}
254
260
255
261
func (c * clientCreator ) NewTokenV4Client (token string ) (* githubv4.Client , error ) {
256
262
ts := oauth2 .StaticTokenSource (& oauth2.Token {AccessToken : token })
257
263
tc := oauth2 .NewClient (context .Background (), ts )
264
+ // The v4 API primarily uses POST requests (except for introspection queries)
265
+ // which we cannot cache, so don't construct the middleware
258
266
return c .newV4Client (tc , nil , "oauth token" )
259
267
}
260
268
You can’t perform that action at this time.
0 commit comments