httputil

package
v0.0.0-...-2658d01 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Successful

func Successful(resp *http.Response, err error) (*http.Response, error)

func WrapTransport

func WrapTransport(base http.RoundTripper, wrapper ...TransportWrapFunc) http.RoundTripper

Types

type ChardetTransport

type ChardetTransport struct {
	Base    http.RoundTripper
	Options []chardet.DetectorOption
	// contains filtered or unexported fields
}

func (*ChardetTransport) RoundTrip

func (t *ChardetTransport) RoundTrip(req *http.Request) (*http.Response, error)

type CharsetTransport

type CharsetTransport struct {
	Base http.RoundTripper
}

CharsetTransport is an http.Transport which automatically decodes resp.Body by its charset.

func (*CharsetTransport) RoundTrip

func (t *CharsetTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

type ErrorHandlerFunc

type ErrorHandlerFunc func(http.ResponseWriter, *http.Request) error

func (ErrorHandlerFunc) ServeHTTP

func (f ErrorHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HTTPError

type HTTPError struct {
	StatusCode int
	Status     string
}

func (*HTTPError) Error

func (e *HTTPError) Error() string

type LimitedTransport

type LimitedTransport struct {
	Base http.RoundTripper
	N    int64
}

func (*LimitedTransport) RoundTrip

func (t *LimitedTransport) RoundTrip(req *http.Request) (*http.Response, error)

type TransportWrapFunc

type TransportWrapFunc func(req *http.Request, base http.RoundTripper) (*http.Response, error)

Jump to

Keyboard shortcuts

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