httputil

package
v1.7.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeferClose

func DeferClose(c io.Closer)

DeferClose captures and prints the error from closing (if an error occurs). This is designed to be used in a defer statement.

func DeleteBodyOK added in v1.2.0

func DeleteBodyOK(httpClient *http.Client, apiURL string) ([]byte, error)

DeleteBodyOK will DELETE and returns the body or an error if the response is not okay

func DoBodyOK added in v1.2.0

func DoBodyOK(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 GetBodyOK

func GetBodyOK(httpClient *http.Client, apiURL string) ([]byte, error)

GetBodyOK returns the body or an error if the response is not okay

func PostBodyOK added in v1.2.0

func PostBodyOK(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 added in v1.2.0

func PutBodyOK(httpClient *http.Client, apiURL string) ([]byte, error)

PutBodyOK will PUT and returns the body or an error if the response is not okay

func ReadErrorBody

func ReadErrorBody(body io.Reader) (err error)

ReadErrorBody in the error case ready the body message. But return it as an error (or return an error from reading the body).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL