Documentation
¶
Index ¶
- func DeferClose(c io.Closer)
- func DeleteBodyOK(ctx context.Context, httpClient *http.Client, apiURL string) ([]byte, error)
- func DoBodyOK(ctx context.Context, httpClient *http.Client, apiURL, method string, ...) ([]byte, error)
- func Errorf(status int, format string, args ...any) error
- func GetBodyOK(ctx context.Context, httpClient *http.Client, apiURL string) ([]byte, error)
- func IsNotFound(err error) bool
- func PostBodyOK(ctx context.Context, httpClient *http.Client, apiURL string, reqBody io.Reader) ([]byte, error)
- func PutBodyOK(ctx context.Context, httpClient *http.Client, apiURL string, reqBody io.Reader) ([]byte, error)
- func ReadErrorBody(body io.Reader) (err error)
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeferClose ¶
DeferClose captures and prints the error from closing (if an error occurs). This is designed to be used in a defer statement.
func DeleteBodyOK ¶
DeleteBodyOK will DELETE and returns the body or an error if the response is not okay
func DoBodyOK ¶
func DoBodyOK(ctx context.Context, httpClient *http.Client, apiURL, method string, reqBody io.Reader) ([]byte, error)
DoBodyOK returns the body or an error if the response is not okay(StatusCode >= 400)
func IsNotFound ¶
func PostBodyOK ¶
func PostBodyOK(ctx context.Context, httpClient *http.Client, apiURL string, reqBody io.Reader) ([]byte, error)
PostBodyOK will POST and returns the body or an error if the response is not okay
func PutBodyOK ¶
func PutBodyOK(ctx context.Context, httpClient *http.Client, apiURL string, reqBody io.Reader) ([]byte, error)
PutBodyOK will PUT and returns the body or an error if the response is not okay
func ReadErrorBody ¶
ReadErrorBody in the error case ready the body message. But return it as an error (or return an error from reading the body).
Types ¶
Click to show internal directories.
Click to hide internal directories.