chttp

package
v0.0.0-...-2b0391e Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package chttp (Cooked HTTP) provides a wrapper around http.Client with cookies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertCookies

func ConvertCookies(cc []http.Cookie) []*http.Cookie

func New

func New(cookieDomain string, cookies []*http.Cookie) *http.Client

New returns the HTTP client with cookies and default transport.

func NewWithTransport

func NewWithTransport(cookieDomain string, cookies []*http.Cookie, rt http.RoundTripper) *http.Client

NewWithTransport inits the HTTP client with cookies. It allows to use the custom Transport.

Types

type Transport

type Transport struct {
	BeforeReq func(req *http.Request)
	AfterReq  func(resp *http.Response, req *http.Request)
	// contains filtered or unexported fields
}

a simple wrapper for http.RoundTripper to do something before and after RoundTrip

func NewTransport

func NewTransport(tr http.RoundTripper) *Transport

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error)

Jump to

Keyboard shortcuts

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