httpx

package
v1.5.10 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package httpx holds bounded body reads and a client with sane defaults.

Index

Constants

View Source
const (
	// DefaultMaxBody caps an API response read into memory.
	DefaultMaxBody int64 = 32 << 20
	// MaxDownload caps a file-style response (CSV export, deploy log) read into memory.
	MaxDownload int64 = 256 << 20
)

Variables

View Source
var ErrBodyTooLarge = errors.New("httpx: response body exceeds limit")

ErrBodyTooLarge is returned when a body exceeds its read limit.

Functions

func NewClient

func NewClient(timeout time.Duration) *http.Client

NewClient returns a client with an overall timeout and a transport that bounds dial, TLS handshake and header waits.

func ReadAll

func ReadAll(r io.Reader, limit int64) ([]byte, error)

ReadAll reads at most limit bytes from r and fails with ErrBodyTooLarge rather than silently truncating when there is more.

func ReadBody

func ReadBody(r io.Reader) ([]byte, error)

ReadBody is ReadAll with DefaultMaxBody.

Types

This section is empty.

Jump to

Keyboard shortcuts

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