Documentation ¶
Overview ¶
Package gorilla/http/client contains the lower level HTTP client implementation.
Package client is divided into two layers. The upper layer is the client.Client layer which handles the vaguaries of http implementations. The lower layer, two types, reader and writer are concerned with encoding and decoding the HTTP data stream on the wire.
The interface presented by client.Client is very powerful. It is not expected that normal consumers of HTTP services will need to operate at this level and should instead user the higher level interfaces in the gorilla/http package.
Index ¶
Constants ¶
const ( INFO_CONTINUE = 100 INFO_SWITCHING_PROTOCOL = 101 INFO_PROCESSING = 102 SUCCESS_OK = 200 SUCCESS_CREATED = 201 SUCCESS_ACCEPTED = 202 SUCCESS_NON_AUTHORITATIVE = 203 SUCCESS_NO_CONTENT = 204 SUCCESS_RESET_CONTENT = 205 SUCCESS_PARTIAL_CONTENT = 206 SUCCESS_MULTI_STATUS = 207 REDIRECTION_MULTIPLE_CHOICES = 300 REDIRECTION_MOVED_PERMANENTLY = 301 REDIRECTION_MOVED_TEMPORARILY = 302 REDIRECTION_SEE_OTHER = 303 REDIRECTION_NOT_MODIFIED = 304 REDIRECTION_USE_PROXY = 305 REDIRECTION_TEMPORARY_REDIRECT = 307 CLIENT_ERROR_BAD_REQUEST = 400 CLIENT_ERROR_UNAUTHORIZED = 401 CLIENT_ERROR_PAYMENT_REQUIRED = 402 CLIENT_ERROR_FORBIDDEN = 403 CLIENT_ERROR_NOT_FOUND = 404 CLIENT_ERROR_METHOD_NOT_ALLOWED = 405 CLIENT_ERROR_NOT_ACCEPTABLE = 406 CLIENT_ERROR_PROXY_AUTHENTIFICATION_REQUIRED = 407 CLIENT_ERROR_REQUEST_TIMEOUT = 408 CLIENT_ERROR_CONFLICT = 409 CLIENT_ERROR_GONE = 410 CLIENT_ERROR_LENGTH_REQUIRED = 411 CLIENT_ERROR_PRECONDITION_FAILED = 412 CLIENT_ERROR_REQUEST_ENTITY_TOO_LARGE = 413 CLIENT_ERROR_REQUEST_URI_TOO_LONG = 414 CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE = 415 CLIENT_ERROR_REQUESTED_RANGE_NOT_SATISFIABLE = 416 CLIENT_ERROR_EXPECTATION_FAILED = 417 CLIENT_ERROR_UNPROCESSABLE_ENTITY = 422 CLIENT_ERROR_LOCKED = 423 CLIENT_ERROR_FAILED_DEPENDENCY = 424 SERVER_ERROR_INTERNAL = 500 SERVER_ERROR_NOT_IMPLEMENTED = 501 SERVER_ERROR_BAD_GATEWAY = 502 SERVER_ERROR_SERVICE_UNAVAILABLE = 503 SERVER_ERROR_GATEWAY_TIMEOUT = 504 SERVER_ERROR_HTTP_VERSION_NOT_SUPPORTED = 505 SERVER_ERROR_INSUFFICIENT_STORAGE = 507 )
Variables ¶
var ( HTTP_1_0 = Version{1, 0} HTTP_1_1 = Version{1, 1} )
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client represents a single connection to a http server. Client obeys KeepAlive conditions for HTTP but connection pooling is expected to be handled at a higher layer.
func NewClient ¶
func NewClient(rw io.ReadWriter) Client
NewClient returns a Client implementation which uses rw to communicate.
type Request ¶
type Request struct { Method string Path string Query []string Version Headers []Header Body io.Reader }
Request represents a complete HTTP request.
func (*Request) ContentLength ¶
ContentLength returns the length of the body. If the body length is not known ContentLength will return -1.
type Response ¶
Response represents an RFC2616 response.
func (*Response) CloseRequested ¶
CloseRequested returns if Reason includes a Connection: close header.
func (*Response) ContentLength ¶
ContentLength returns the length of the body. If the body length is not known ContentLength will return -1.
func (*Response) TransferEncoding ¶
TransferEncoding returns the transfer encoding this message was transmitted with. If not is specified by the sender, "identity" is assumed.
type Status ¶
Status represents an HTTP status code.