Documentation
¶
Index ¶
Constants ¶
const ( // The maximum number of times to try sending a request before we give up // (assuming any unsuccessful attempts can be sensibly tried again). MaxSendAttempts = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func (*Client) BinaryRequest ¶
func (c *Client) BinaryRequest(method, url, rfc1123Date string, request *RequestData, response *ResponseData) (err error)
Sends the byte array in reqData.ReqValue (if any) to the specified URL. Optional method arguments are passed using the RequestData object. Relevant RequestData fields: ReqHeaders: additional HTTP header values to add to the request. ExpectedStatus: the allowed HTTP response status values, else an error is returned. ReqReader: an io.Reader providing the bytes to send. RespReader: assigned an io.ReadCloser instance used to read the returned data..
func (*Client) JsonRequest ¶
func (c *Client) JsonRequest(method, url, rfc1123Date string, request *RequestData, response *ResponseData) (err error)
JsonRequest JSON encodes and sends the object in reqData.ReqValue (if any) to the specified URL. Optional method arguments are passed using the RequestData object. Relevant RequestData fields: ReqHeaders: additional HTTP header values to add to the request. ExpectedStatus: the allowed HTTP response status values, else an error is returned. ReqValue: the data object to send. RespValue: the data object to decode the result into.
type ErrorResponse ¶
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type ErrorWrapper ¶
type ErrorWrapper struct {
Error ErrorResponse `json:"error"`
}
type RequestData ¶
type ResponseData ¶
type ResponseData struct { ExpectedStatus []int RespHeaders *http.Header RespValue interface{} RespReader io.ReadCloser }