Documentation
¶
Overview ¶
Package chttp (Cooked HTTP) provides a wrapper around http.Client with cookies, that are added to each request. It also allows to use custom Transport, which wraps the default transport and calls the user-defined function before and after the request.
Index ¶
- func Close(cl *http.Client) error
- func CookiesToPtr(cookies []http.Cookie) []*http.Cookie
- func Must(cl *http.Client, err error) *http.Client
- func New(cookieDomain string, cookies []*http.Cookie, opts ...Option) (*http.Client, error)
- func NewWithTransport(cookieDomain string, cookies []*http.Cookie, rt http.RoundTripper) (*http.Client, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Close ¶ added in v2.1.0
Close releases resources held by the client's transport. It is safe to call on clients whose transport does not require cleanup (e.g. FuncTransport) — in that case it is a no-op.
func CookiesToPtr ¶
CookiesToPtr is a convenience function that returns the slice with pointers to cookies.
func NewWithTransport ¶
func NewWithTransport(cookieDomain string, cookies []*http.Cookie, rt http.RoundTripper) (*http.Client, error)
NewWithTransport inits the HTTP client with cookies. It allows to use the custom Transport.
Types ¶
Click to show internal directories.
Click to hide internal directories.