Versions in this module Expand all Collapse all v0 v0.0.2 Jul 31, 2023 Changes in this version + var ErrInvalidHandled = errors.New("handled recovery from invalid response") + var ToHeaders = CopyHeaders + func HasStatusErr(err error, codes ...int) bool + func NewCookieJar() http.CookieJar + type BodyGetter = func() (io.ReadCloser, error) + func BodyBytes(b []byte) BodyGetter + func BodyFile(name string) BodyGetter + func BodyForm(data url.Values) BodyGetter + func BodyJSON(v any) BodyGetter + func BodyReader(r io.Reader) BodyGetter + func BodyWriter(f func(w io.Writer) error) BodyGetter + type Builder struct + func New(cfgs ...Config) *Builder + func URL(baseurl string) *Builder + func (rb *Builder) Accept(contentTypes string) *Builder + func (rb *Builder) AddValidator(h ResponseHandler) *Builder + func (rb *Builder) Akamai(path, section string) *Builder + func (rb *Builder) BaseURL(baseurl string) *Builder + func (rb *Builder) BasicAuth(username, password string) *Builder + func (rb *Builder) Bearer(token string) *Builder + func (rb *Builder) Body(src BodyGetter) *Builder + func (rb *Builder) BodyBytes(b []byte) *Builder + func (rb *Builder) BodyFile(name string) *Builder + func (rb *Builder) BodyForm(data url.Values) *Builder + func (rb *Builder) BodyJSON(v any) *Builder + func (rb *Builder) BodyReader(r io.Reader) *Builder + func (rb *Builder) BodyWriter(f func(w io.Writer) error) *Builder + func (rb *Builder) CacheControl(directive string) *Builder + func (rb *Builder) CheckContentType(cts ...string) *Builder + func (rb *Builder) CheckPeek(n int, f func([]byte) error) *Builder + func (rb *Builder) CheckStatus(acceptStatuses ...int) *Builder + func (rb *Builder) Client(cl *http.Client) *Builder + func (rb *Builder) Clone() *Builder + func (rb *Builder) Config(cfgs ...Config) *Builder + func (rb *Builder) ContentType(ct string) *Builder + func (rb *Builder) Cookie(name, value string) *Builder + func (rb *Builder) CopyHeaders(h map[string][]string) *Builder + func (rb *Builder) Delete() *Builder + func (rb *Builder) Do(req *http.Request) (err error) + func (rb *Builder) ErrorJSON(v any) *Builder + func (rb *Builder) Fetch(ctx context.Context) (err error) + func (rb *Builder) Handle(h ResponseHandler) *Builder + func (rb *Builder) Head() *Builder + func (rb *Builder) Header(key string, values ...string) *Builder + func (rb *Builder) Headers(m map[string][]string) *Builder + func (rb *Builder) Host(host string) *Builder + func (rb *Builder) Hostf(format string, a ...any) *Builder + func (rb *Builder) Method(method string) *Builder + func (rb *Builder) Param(key string, values ...string) *Builder + func (rb *Builder) ParamInt(key string, value int) *Builder + func (rb *Builder) Params(m map[string][]string) *Builder + func (rb *Builder) Patch() *Builder + func (rb *Builder) Path(path string) *Builder + func (rb *Builder) Pathf(format string, a ...any) *Builder + func (rb *Builder) Post() *Builder + func (rb *Builder) Put() *Builder + func (rb *Builder) Request(ctx context.Context) (req *http.Request, err error) + func (rb *Builder) Scheme(scheme string) *Builder + func (rb *Builder) ToBytesBuffer(buf *bytes.Buffer) *Builder + func (rb *Builder) ToFile(name string) *Builder + func (rb *Builder) ToHeaders(h map[string][]string) *Builder + func (rb *Builder) ToJSON(v any) *Builder + func (rb *Builder) ToString(sp *string) *Builder + func (rb *Builder) ToWriter(w io.Writer) *Builder + func (rb *Builder) Transport(rt http.RoundTripper) *Builder + func (rb *Builder) URL() (u *url.URL, err error) + func (rb *Builder) UserAgent(s string) *Builder + type CheckRedirectPolicy = func(req *http.Request, via []*http.Request) error + var NoFollow CheckRedirectPolicy = MaxFollow(0) + func MaxFollow(n int) CheckRedirectPolicy + type Config = func(rb *Builder) + func GzipConfig(level int, h func(gw *gzip.Writer) error) Config + func TestServerConfig(s *httptest.Server) Config + type ErrorKind int8 + const ErrHandler + const ErrRequest + const ErrTransport + const ErrURL + const ErrValidator + func (ek ErrorKind) Error() string + func (i ErrorKind) String() string + type ResponseError http.Response + func (se *ResponseError) Error() string + type ResponseHandler = func(*http.Response) error + var DefaultValidator ResponseHandler = CheckStatus(http.StatusOK, http.StatusCreated, http.StatusAccepted, ...) + func ChainHandlers(handlers ...ResponseHandler) ResponseHandler + func CheckContentType(cts ...string) ResponseHandler + func CheckPeek(n int, f func([]byte) error) ResponseHandler + func CheckStatus(acceptStatuses ...int) ResponseHandler + func CopyHeaders(h map[string][]string) ResponseHandler + func ErrorJSON(v any) ResponseHandler + func ToBufioReader(f func(r *bufio.Reader) error) ResponseHandler + func ToBufioScanner(f func(r *bufio.Scanner) error) ResponseHandler + func ToBytesBuffer(buf *bytes.Buffer) ResponseHandler + func ToFile(name string) ResponseHandler + func ToHTML(n *html.Node) ResponseHandler + func ToJSON(v any) ResponseHandler + func ToString(sp *string) ResponseHandler + func ToWriter(w io.Writer) ResponseHandler + func ValidatorHandler(v, h ResponseHandler) ResponseHandler + type RoundTripFunc func(req *http.Request) (res *http.Response, err error) + func (rtf RoundTripFunc) RoundTrip(r *http.Request) (*http.Response, error) + type Transport = http.RoundTripper + func Caching(rt http.RoundTripper, basepath string) Transport + func DoerTransport(cl interface{ ... }) Transport + func LogTransport(rt http.RoundTripper, ...) Transport + func PermitURLTransport(rt http.RoundTripper, regex string) Transport + func Record(rt http.RoundTripper, basepath string) Transport + func Replay(basepath string) Transport + func ReplayFS(fsys fs.FS) Transport + func ReplayString(rawResponse string) Transport + func UserAgentTransport(rt http.RoundTripper, s string) Transport