Files
fn-serverless/vendor/github.com/dghubble/oauth1/context.go
2017-06-11 02:05:36 -07:00

25 lines
537 B
Go

package oauth1
import (
"net/http"
"golang.org/x/net/context"
)
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
}