Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QueryParam ¶
type RESTRequest ¶
type RESTRequest struct { URI string Method string Endpoint string QueryParams []QueryParam Headers []Header Payload interface{} }
func (*RESTRequest) BuildHTTPRequest ¶
func (r *RESTRequest) BuildHTTPRequest() (*http.Request, error)
BuildHTTPRequest constructs the complete net/http object which is needed to perform a final HTTP request.
It is not necessary to use this function, but it may be useful if the net.Request object needs to be inspected or modified for advanced use cases.
func (*RESTRequest) Submit ¶
func (r *RESTRequest) Submit() (*RESTResponse, error)
Submit performs the HTTP request, returning a resultant RESTResponse Usage:
request = &RESTRequest{ ... } response, _ := request.Submit()
func (*RESTRequest) SubmitStrict ¶
func (r *RESTRequest) SubmitStrict() (*RESTResponse, error)
SubmitStrict performs the HTTP request, returning a resultant RESTResponse if the response's status code is < 400. Usage:
request = &RESTRequest{ ... } response, _ := request.Submit()
type RESTResponse ¶
func (*RESTResponse) PayloadAsPrettyJSONString ¶
func (r *RESTResponse) PayloadAsPrettyJSONString() (string, error)
PayloadAsPrettyJSONString returns the response body as a formatted JSON string The response body must be valid JSON in the form either of a list or a map.
func (*RESTResponse) PayloadAsString ¶
func (r *RESTResponse) PayloadAsString() (string, error)
PayloadAsString returns the response body as a string.
func (*RESTResponse) UnmarshalPayload ¶
func (r *RESTResponse) UnmarshalPayload(v interface{}) error
UnmarshalPayload converts the raw response body into the given interface Usage:
var foo MyStruct response.UnmarshalPayload(&foo)
type RESTResponseError ¶
func (*RESTResponseError) Error ¶
func (e *RESTResponseError) Error() string