Documentation ¶
Index ¶
Constants ¶
View Source
const ( // AcceptHeader is the canonical header name for accept. AcceptHeader = "Accept" // AcceptEncodingHeader is the canonical header name for accept encoding. AcceptEncodingHeader = "Accept-Encoding" // ContentEncodingHeader is the canonical header name for content type. ContentEncodingHeader = "Content-Encoding" // ContentTypeHeader is the canonical header name for content type. ContentTypeHeader = "Content-Type" // JSONContentType is the JSON content type. JSONContentType = "application/json" // AltJSONContentType is the alternate JSON content type. AltJSONContentType = "application/x-json" // ProtoContentType is the protobuf content type. ProtoContentType = "application/x-protobuf" // AltProtoContentType is the alternate protobuf content type. AltProtoContentType = "application/x-google-protobuf" // PlaintextContentType is the plaintext content type. PlaintextContentType = "text/plain" // GzipEncoding is the gzip encoding. GzipEncoding = "gzip" )
Variables ¶
This section is empty.
Functions ¶
func GetJSON ¶
GetJSON uses the supplied client to GET the URL specified by the parameters and unmarshals the result into response.
func PostJSON ¶
PostJSON uses the supplied client to POST request to the URL specified by the parameters and unmarshals the result into response.
func PostJSONWithHeaders ¶
func PostJSONWithHeaders( httpClient http.Client, path string, headerFn httpHeaderFn, request, response proto.Message, ) (http.Header, error)
PostJSONWithHeaders uses the supplied client to POST request to the URL specified by the parameters and unmarshals the result into response.
The caller can provide an optional callback function that can modify outgoing HTTP headers before the request is sent. Headers returned with the response are returned to the caller.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.