httpctx

package
v0.0.0-...-c66a2f6 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientGet

func ClientGet(ctx context.Context, c *http.Client, url string) (resp *http.Response, err error)

ClientGet issues a GET to the specified URL.

Caller should close resp.Body when done reading from it.

func ClientPost

func ClientPost(ctx context.Context, c *http.Client, url, contentType string, body io.Reader) (resp *http.Response, err error)

ClientPost issues a POST to the specified URL.

Caller should close resp.Body when done reading from it.

If the provided body is an io.Closer, it is closed after the request.

To set custom headers, use NewRequestWithContext and Client.Do.

func Get

func Get(ctx context.Context, url string) (resp *http.Response, err error)

Get issues a GET to the specified URL using DefaultClient.

Caller should close resp.Body when done reading from it.

func Post

func Post(ctx context.Context, url, contentType string, body io.Reader) (resp *http.Response, err error)

Post issues a POST to the specified URL using DefaultClient.

Caller should close resp.Body when done reading from it.

If the provided body is an io.Closer, it is closed after the request.

To set custom headers, use NewRequestWithContext and Client.Do.

Types

This section is empty.

Jump to

Keyboard shortcuts

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