request

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompressionType

type CompressionType string
const (
	CompressionNone    CompressionType = ""
	CompressionGzip    CompressionType = "gzip"
	CompressionDeflate CompressionType = "deflate"
	CompressionBrotli  CompressionType = "br"
)

type Options

type Options struct {
	Headers         []kv.Header     // Custom headers to be added to the request.
	Cookies         []*http.Cookie  // Cookies to be included in the request.
	ProtocolScheme  string          // define a custom protocol scheme. It defaults to https
	Compression     CompressionType // CompressionType to use: none, gzip, deflate or brotli
	UserAgent       string          // User Agent to send with requests
	DisableRedirect bool            // Disable or enable redirects. Default is false - do not disable redirects
}

RequestOptions represents additional options for the HTTP request.

DisableRedirect - Determines if redirects should be followed or not. The default option is false which means redirects will be followed.

func NewOptions

func NewOptions() Options

func (*Options) AddCookie

func (opt *Options) AddCookie(cookie *http.Cookie)

AddCookie adds a new cookie to the RequestOptions.

func (*Options) AddHeader

func (opt *Options) AddHeader(key string, value string)

AddHeader adds a new header to the RequestOptions.

func (*Options) ClearCookies

func (opt *Options) ClearCookies()

ClearCookies clears all cookies in the RequestOptions.

func (*Options) ClearHeaders

func (opt *Options) ClearHeaders()

ClearHeaders clears all headers in the RequestOptions.

func (*Options) Compress

func (opt *Options) Compress(compressionType CompressionType)

func (*Options) DisableRedirects

func (opt *Options) DisableRedirects() bool

func (*Options) EnableRedirects

func (opt *Options) EnableRedirects() bool

func (*Options) ListCookies

func (opt *Options) ListCookies()

ListCookies prints out the list of cookies in the RequestOptions.

func (*Options) ListHeaders

func (opt *Options) ListHeaders()

ListHeaders prints out the list of headers in the RequestOptions.

func (*Options) SetProtocolScheme

func (opt *Options) SetProtocolScheme(scheme string)

Jump to

Keyboard shortcuts

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