func (t *tokenTransport) RoundTrip(req *http.Request) (*http.Response, error) {
	defer func() {
		if !t.reuseOAuthToken {
			// We usually do not re-use the OAuth token because each API call might have different scope.
			// But some of the provider use long life token and there is no need to refresh.
			t.OAuthToken = ""
		}
	}()

	if err := t.authorizeRequest(req); err != nil {
		return nil, errors.Trace(err)
	}
	resp, err := t.transport.RoundTrip(req)
	if err != nil {
		return nil, errors.Trace(err)
	}
	if isUnauthorizedResponse(resp) {
		// refresh token and retry.
		return t.retry(req, resp)
	}
	return resp, errors.Trace(err)
}
// RoundTrip executes a single HTTP transaction, returning a Response for the provided Request.
RoundTrip executes a single HTTP transaction, returning a Response for the provided Request.
// RoundTrip executes a single HTTP transaction returning a Response for the provided Request .
func (t *tokenTransport) RoundTrip(req *http.Request) (*http.Response, error) {
	defer func() {
		if !t.reuseOAuthToken {
			t.OAuthToken = ""
		}
	}()
	if err := t.authorizeRequest(req); err != nil {
		return nil, errors.Trace(err)
	}
	resp, err := t.transport.RoundTrip(req)
	if err != nil {
		return nil, errors.Trace(err)
	}
	if isUnauthorizedResponse(resp) {
		return t.retry(req, resp)
	}
	return resp, errors.Trace(err)
}
func ( t * tokenTransport ) RoundTrip ( req * http . Request ) ( * http . Response , error ) { defer func ( ) { if ! t . reuseOAuthToken { t . OAuthToken = " " } } ( ) if err := t . authorizeRequest ( req ) ; err != nil { return nil , errors . Trace ( err ) } resp , err := t . transport . RoundTrip ( req ) if err != nil { return nil , errors . Trace ( err ) } if isUnauthorizedResponse ( resp ) { return t . retry ( req , resp ) } return resp , errors . Trace ( err ) }
RoundTrip executes a single HTTP transaction, returning a Response for the provided Request.
RoundTrip executes a single HTTP transaction returning a Response for the provided Request .
// We usually do not re-use the OAuth token because each API call might have different scope. // But some of the provider use long life token and there is no need to refresh. // refresh token and retry.