workgroups/vendor/github.com/dghubble/oauth1/context.go
Marvin Preuss 1d4ae27878
All checks were successful
continuous-integration/drone/push Build is passing
ci: drone yaml with reusable anchors
2021-09-24 17:34:17 +02:00

24 lines
519 B
Go

package oauth1
import (
"context"
"net/http"
)
type contextKey struct{}
// HTTPClient is the context key to associate an *http.Client value with
// a context.
var HTTPClient contextKey
// NoContext is the default context to use in most cases.
var NoContext = context.TODO()
// contextTransport gets the Transport from the context client or nil.
func contextTransport(ctx context.Context) http.RoundTripper {
if client, ok := ctx.Value(HTTPClient).(*http.Client); ok {
return client.Transport
}
return nil
}