httpx

package
v0.1.18-rc17 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxErrorBodyBytes    int64 = 2048
	MaxJSONBodyBytes     int64 = 1 << 20
	MaxDownloadBodyBytes int64 = 64 << 20
	MaxGunzipOutputBytes int64 = 256 << 20
)

Variables

This section is empty.

Functions

func CheckStatus

func CheckStatus(resp *http.Response, expected int, action string) error

func DecodeResponseJSON

func DecodeResponseJSON(r io.Reader, out any, limit int64) error

func DoJSON

func DoJSON[T any](ctx context.Context, client *http.Client, method, endpoint string, body any, expectedStatus int, action string) (T, error)

DoJSON executes one bounded JSON request and requires exactly one expected status.

func DrainAndClose

func DrainAndClose(resp *http.Response)

func GunzipToBytes

func GunzipToBytes(r io.Reader, maxBytes int64) ([]byte, error)

func NewHeaderTransport

func NewHeaderTransport(base http.RoundTripper, headers http.Header) http.RoundTripper

NewHeaderTransport returns a transport that overlays headers without modifying the caller's request.

func ReadErrorMessage

func ReadErrorMessage(r io.Reader, status string, limit int64) string

func RequireClientAndURL

func RequireClientAndURL(client *http.Client, base *url.URL) error

func WrapError

func WrapError(prefix string, status string, r io.Reader) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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