Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRequestError is returned when a request could not be made ErrRequestError = erx.New("HTTP Client", "failed to make request") // ErrCodingError is returned when encoding or decoding request or response bodies has failed ErrCodingError = erx.New("HTTP Client", "failed to marshal values") )
Functions ¶
This section is empty.
Types ¶
type Codeable ¶
type Codeable interface { Encodable Decodeable }
func JSON ¶
func JSON(v interface{}, constraints ...Constraint) Codeable
type Constraint ¶
var ConstraintFailed Constraint = func(response *http.Response) bool { return response.StatusCode >= http.StatusBadRequest }
ConstraintFailed is a constraint to filter for failed http responses.
var ConstraintNone Constraint = func(response *http.Response) bool { return true }
ConstraintNone is a helper function that filters for nothing and allows everything.
var ConstraintSuccess Constraint = func(response *http.Response) bool { return response.StatusCode >= http.StatusOK && response.StatusCode < http.StatusMultipleChoices }
ConstraintSuccess is a helper function to filter for successful http responses.
type Decodeable ¶
Click to show internal directories.
Click to hide internal directories.