xhttp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package xhttp provides utilities and functions for working with HTTP.

Index

Constants

View Source
const (
	// DefaultMaxIddleConns is the default maximum number of idle connections in
	// the pool.
	DefaultMaxIddleConns int = 100

	// DefaultMaxIddleConnsPerHost is the default maximum number of idle connections in
	// the pool per host.
	DefaultMaxIddleConnsPerHost int = 10

	// DefaultLRUClientSessionCacheCapacity is the default capacity of the LRU client session cache.
	DefaultLRUClientSessionCacheCapacity int = 64
)
View Source
const (
	// ErrCannotDrainResponse is returned when a response body cannot be drained.
	ErrCannotDrainResponse xerrors.Error = "cannot drain response body"

	// ErrCannotCloseResponse is returned when a response body cannot be closed.
	ErrCannotCloseResponse xerrors.Error = "cannot close response body"
)

Variables

This section is empty.

Functions

func DrainResponseBody

func DrainResponseBody(resp *http.Response) error

DrainResponseBody reads and discards the remaining content of the response body until EOF, then closes it. If an error occurs while draining or closing the response body, an error is returned.

func NewClient

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

NewClient creates a new HTTP client with sane defaults given the provided timeout.

Types

This section is empty.

Jump to

Keyboard shortcuts

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