go4.orggo4.org/ctxutil Index | Files

package ctxutil

import "go4.org/ctxutil"

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

Index

Variables

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.

Functions

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.

Source Files

ctxutil.go

Version
v0.0.0-20230225012048-214862532bf5 (latest)
Published
Feb 25, 2023
Platform
linux/amd64
Imports
3 packages
Last checked
1 month ago

Tools for package owners.