package ctxhttp
import "github.com/etcd-io/etcd/Godeps/_workspace/src/golang.org/x/net/context/ctxhttp"
Package ctxhttp provides helper functions for performing context-aware HTTP requests.
Index ¶
- func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error)
- func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error)
- func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error)
- func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error)
- func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error)
Functions ¶
func Do ¶
Do sends an HTTP request with the provided http.Client and returns an HTTP response. If the client is nil, http.DefaultClient is used. If the context is canceled or times out, ctx.Err() will be returned.
func Get ¶
Get issues a GET request via the Do function.
func Head ¶
Head issues a HEAD request via the Do function.
func Post ¶
func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error)
Post issues a POST request via the Do function.
func PostForm ¶
func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error)
PostForm issues a POST request via the Do function.
Source Files ¶
- Version
- v2.3.8+incompatible (latest)
- Published
- Feb 16, 2017
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 month ago –
Tools for package owners.