go4.org: go4.org/ctxutil Index | Files

package ctxutil

import "go4.org/ctxutil"

Package ctxutil contains golang.org/x/net/context related utilities.


Package Files



var HTTPClient = oauth2.HTTPClient

HTTPClient is the context key to use with golang.org/x/net/context's WithValue function to associate an *http.Client value with a context.

We use the same value as the oauth2 package (which first introduced this key) rather than creating a new one and forcing users to possibly set two.

func Client Uses

func Client(ctx context.Context) *http.Client

Client returns the HTTP client to use for the provided context. If ctx is non-nil and has an associated HTTP client, that client is returned. Otherwise, http.DefaultClient is returned.

Package ctxutil imports 3 packages (graph) and is imported by 42 packages. Updated 2016-07-18. Refresh now. Tools for package owners.