request

package
v1.2.60 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecompressHttpResponse added in v1.2.57

func DecompressHttpResponse(body io.ReadCloser, contentEncoding string) (io.ReadCloser, error)

DecompressHttpResponse to read it's contents

func DefaultClient

func DefaultClient() *http.Client

DefaultClient for HTTP requests

func Firefox117Client added in v1.2.57

func Firefox117Client() *http.Client

Firefox117Client tries to impersonate firefox117 https://github.com/lwthiker/curl-impersonate/blob/main/firefox/curl_ff117

func Get

func Get(URL string) (string, error)

Get content as string

func GetAsBytes

func GetAsBytes(URL string) ([]byte, error)

GetAsBytes content as bytes

func GetAsBytesWithClient added in v1.2.57

func GetAsBytesWithClient(client *http.Client, URL string, referer string) ([]byte, error)

GetAsBytesWithClient content as bytes using a custom client

func GetAsBytesWithHeaders

func GetAsBytesWithHeaders(URL string, headers map[string]string) ([]byte, error)

GetAsBytesWithHeaders content as bytes

func GetSizeFromHeaders

func GetSizeFromHeaders(headers *http.Header) (int64, error)

GetSizeFromHeaders of http.Response

func GetWithCookies added in v1.2.21

func GetWithCookies(URL string, jar *Myjar) (string, error)

GetWithCookies content as string

func GetWithHeaders

func GetWithHeaders(URL string, headers map[string]string) (string, error)

GetWithHeaders content as string

func Headers

func Headers(URL, refer string) (http.Header, error)

Headers of a HTTP response

func PostAsBytes

func PostAsBytes(URL string) ([]byte, error)

PostAsBytes content as bytes

func PostAsBytesWithHeaders

func PostAsBytesWithHeaders(URL string, headers map[string]string, body io.Reader) ([]byte, error)

PostAsBytesWithHeaders content as bytes

func Request

func Request(method string, URL string, headers map[string]string, body io.Reader) (*http.Response, error)

Request HTTP

func Size

func Size(URL, refer string) (int64, error)

Size of a HTTP content in response

Types

type LogRedirects

type LogRedirects struct {
	Transport http.RoundTripper
}

LogRedirects to sanitize "Location" URLs

func (LogRedirects) RoundTrip

func (l LogRedirects) RoundTrip(req *http.Request) (resp *http.Response, err error)

RoundTrip implementation

type Myjar

type Myjar struct {
	Jar map[string][]*http.Cookie
}

Myjar of client

func (*Myjar) Cookies

func (p *Myjar) Cookies(u *url.URL) []*http.Cookie

Cookies of client

func (*Myjar) New added in v1.2.21

func (p *Myjar) New()

func (*Myjar) SetCookies

func (p *Myjar) SetCookies(u *url.URL, cookies []*http.Cookie)

SetCookies of client

Jump to

Keyboard shortcuts

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