Documentation ¶
Index ¶
- func Delete(ctx context.Context, url string) ([]byte, int, error)
- func Get(ctx context.Context, url string) ([]byte, int, error)
- func HandleError(ctx context.Context, err error, w http.ResponseWriter)
- func HandleResponse(w http.ResponseWriter, b []byte, statusCode int)
- func IsOkResponse(resp *http.Response) bool
- func MarshalFormat(ctx context.Context, v interface{}) ([]byte, error)
- func NewRequest(ctx context.Context, method, url string, body io.Reader) (*http.Request, error)
- func Patch(ctx context.Context, url string, requestModel interface{}) ([]byte, int, error)
- func Post(ctx context.Context, url string, requestModel interface{}) ([]byte, int, error)
- func ProcessResponse(ctx context.Context, v interface{}, w http.ResponseWriter, statusCode int)
- func Put(ctx context.Context, url string, requestModel interface{}) ([]byte, int, error)
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleError ¶
func HandleError(ctx context.Context, err error, w http.ResponseWriter)
func HandleResponse ¶
func HandleResponse(w http.ResponseWriter, b []byte, statusCode int)
func IsOkResponse ¶
Validates that the response code is a 2xx
func NewRequest ¶ added in v0.0.5
func Patch ¶ added in v0.0.7
Does a PUT to the specified endpoint. Returns the body bytes, an http status code (0 if no call was made)
func Post ¶ added in v0.0.5
Does a POST to the specified endpoint. Returns the body bytes, an http status code (0 if no call was made)
func ProcessResponse ¶
func ProcessResponse(ctx context.Context, v interface{}, w http.ResponseWriter, statusCode int)
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
Click to show internal directories.
Click to hide internal directories.