requester

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpWithCookies

type HttpWithCookies struct {
	// contains filtered or unexported fields
}

HttpWithCookies implements Requester with the default net/http Client. Also, a map of cookie jars is utilized to choose between and manipulate the behavior of cookie handling.

func NewHttpWithCookies

func NewHttpWithCookies(cfg func(client *http.Client)) *HttpWithCookies

NewHttpWithCookies returns a new instance of HttpWithCookies. cfg is getting passed the instance of http.Client which you can configure as you desire.

func (HttpWithCookies) Do

func (t HttpWithCookies) Do(req *http.Request, opt Options) (*http.Response, error)

type Options

type Options struct {
	CookieJar    any
	StoreCookies bool
	SendCookies  bool
	ResponseType string
}

Options wraps request specific options.

func OptionsFromMap

func OptionsFromMap(m map[string]any) Options

OptionsFromMap takes a map and builds an Options instance from matching key-value pairs.

type Requester

type Requester interface {
	// Do takes a HTTP requests, executes it and
	// returns the response.
	Do(req *http.Request, opt Options) (*http.Response, error)
}

Requester defines a service to perform HTTP requests.

Jump to

Keyboard shortcuts

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