ctxutil - ActiveState ActiveGo 1.8
...

Package ctxutil

import "go4.org/ctxutil"
Overview
Index

Overview ▾

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

Variables

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.

var HTTPClient = oauth2.HTTPClient

func Client

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.