httpc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	C = &http.Client{
		Transport: http.DefaultTransport,
		Timeout:   time.Second * 30,
	} // allowed to reset
	ErrRespStatusCodeNotExpected = errors.New("response status code not expected")
)

Functions

func D

func D(method string, url string, body []byte, expectedStatusCode int, headersKV ...string) (
	[]byte, *http.Response, error,
)

func Dctx

func Dctx(ctx context.Context, method string, url string, body []byte, expectedStatusCode int, headersKV ...string) (
	[]byte, *http.Response, error,
)

func Do

func Do(req *http.Request) (*http.Response, error)

func DoBody

func DoBody(req *http.Request) ([]byte, *http.Response, error)

func DoCtx

func DoCtx(ctx context.Context, req *http.Request) (*http.Response, error)

func DoRaw

func DoRaw(method string, url string, body []byte, expectedStatusCode int, headersKV ...string) (
	*http.Response, error,
)

func DoRawCtx

func DoRawCtx(ctx context.Context, method string, url string, body []byte, checkCode int, headersKV ...string) (
	*http.Response, error,
)

func DoRawTimeout

func DoRawTimeout(timeout time.Duration, method string, url string, body []byte, checkCode int, headersKV ...string) (
	*http.Response, error,
)

func DoTimeout

func DoTimeout(req *http.Request, timeout time.Duration) (*http.Response, error)

func Dtimeout

func Dtimeout(timeout time.Duration, method string, url string, body []byte, checkCode int, headersKV ...string) (
	[]byte, *http.Response, error,
)

func G

func G(url string, headersKV ...string) ([]byte, *http.Response, error)

func Gctx

func Gctx(ctx context.Context, url string, headersKV ...string) ([]byte, *http.Response, error)

func Get

func Get(url string, headersKV ...string) (*http.Response, error)

func GetCtx

func GetCtx(ctx context.Context, url string, headersKV ...string) (*http.Response, error)

func GetTimeout

func GetTimeout(timeout time.Duration, url string, headersKV ...string) (*http.Response, error)

func Gtimeout

func Gtimeout(timeout time.Duration, url string, headersKV ...string) ([]byte, *http.Response, error)

func P

func P(url string, body []byte, headersKV ...string) ([]byte, *http.Response, error)

func Pctx

func Pctx(ctx context.Context, url string, body []byte, headersKV ...string) ([]byte, *http.Response, error)

func Post

func Post(url string, body []byte, expectedStatusCode int, headersKV ...string) (*http.Response, error)

func PostCtx

func PostCtx(ctx context.Context, url string, body []byte, expectedStatusCode int, headersKV ...string) (
	*http.Response, error,
)

func PostTimeout

func PostTimeout(timeout time.Duration, url string, body []byte, expectedStatusCode int, headersKV ...string) (
	*http.Response, error,
)

func Ptimeout

func Ptimeout(timeout time.Duration, url string, body []byte, headersKV ...string) ([]byte, *http.Response, error)

func Pu

func Pu(url string, body []byte, headersKV ...string) ([]byte, *http.Response, error)

func PuCtx

func PuCtx(ctx context.Context, url string, body []byte, headersKV ...string) ([]byte, *http.Response, error)

func PuTimeout

func PuTimeout(timeout time.Duration, url string, body []byte, headersKV ...string) ([]byte, *http.Response, error)

func Put

func Put(url string, body []byte, expectedStatusCode int, headersKV ...string) (*http.Response, error)

func PutCtx

func PutCtx(ctx context.Context, url string, body []byte, expectedStatusCode int, headersKV ...string) (
	*http.Response, error,
)

func PutTimeout

func PutTimeout(timeout time.Duration, url string, body []byte, expectedStatusCode int, headersKV ...string) (
	*http.Response, error,
)

Types

This section is empty.

Jump to

Keyboard shortcuts

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