MCPcopy Index your code
hub / github.com/coder/coder / wrapClient

Method wrapClient

coderd/promoauth/oauth2.go:244–246  ·  view source on GitHub ↗

wrapClient is the only way we can accurately instrument the oauth2 client. This is because method calls to the 'OAuth2Config' interface are not 1:1 with network requests. For example, the 'TokenSource' method will return a token source that will make a network request when the 'Token' method is cal

(ctx context.Context, source Oauth2Source)

Source from the content-addressed store, hash-verified

242// source that will make a network request when the 'Token' method is called on
243// it if the token is expired.
244func (c *Config) wrapClient(ctx context.Context, source Oauth2Source) context.Context {
245 return context.WithValue(ctx, oauth2.HTTPClient, c.oauthHTTPClient(ctx, source))
246}
247
248// oauthHTTPClient returns an http client that will instrument every request made.
249func (c *Config) oauthHTTPClient(ctx context.Context, source Oauth2Source) *http.Client {

Callers 2

ExchangeMethod · 0.95
TokenSourceMethod · 0.95

Calls 1

oauthHTTPClientMethod · 0.95

Tested by

no test coverage detected