mirror of
https://github.com/golang/go
synced 2024-11-22 01:34:41 -07:00
http: document http client/transport thread safety
Fixes #1961 R=golang-dev, rsc, r CC=golang-dev https://golang.org/cl/4633045
This commit is contained in:
parent
fc77e82617
commit
380e5a3709
@ -16,6 +16,11 @@ import (
|
|||||||
|
|
||||||
// A Client is an HTTP client. Its zero value (DefaultClient) is a usable client
|
// A Client is an HTTP client. Its zero value (DefaultClient) is a usable client
|
||||||
// that uses DefaultTransport.
|
// that uses DefaultTransport.
|
||||||
|
//
|
||||||
|
// The Client's Transport typically has internal state (cached
|
||||||
|
// TCP connections), so Clients should be reused instead of created as
|
||||||
|
// needed. Clients are safe for concurrent use by multiple goroutines.
|
||||||
|
//
|
||||||
// Client is not yet very configurable.
|
// Client is not yet very configurable.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
Transport RoundTripper // if nil, DefaultTransport is used
|
Transport RoundTripper // if nil, DefaultTransport is used
|
||||||
@ -36,6 +41,9 @@ var DefaultClient = &Client{}
|
|||||||
|
|
||||||
// RoundTripper is an interface representing the ability to execute a
|
// RoundTripper is an interface representing the ability to execute a
|
||||||
// single HTTP transaction, obtaining the Response for a given Request.
|
// single HTTP transaction, obtaining the Response for a given Request.
|
||||||
|
//
|
||||||
|
// A RoundTripper must be safe for concurrent use by multiple
|
||||||
|
// goroutines.
|
||||||
type RoundTripper interface {
|
type RoundTripper interface {
|
||||||
// RoundTrip executes a single HTTP transaction, returning
|
// RoundTrip executes a single HTTP transaction, returning
|
||||||
// the Response for the request req. RoundTrip should not
|
// the Response for the request req. RoundTrip should not
|
||||||
|
Loading…
Reference in New Issue
Block a user