request

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultClient added in v0.8.3

func SetDefaultClient(client *Client)

Types

type Client added in v0.6.1

type Client struct {
	*http.Client
	Header  http.Header
	Cookies []*http.Cookie
}

func GetDefaultClient added in v0.8.3

func GetDefaultClient() *Client

func NewClient added in v0.6.1

func NewClient(opts NewClientOptions) *Client

func (*Client) ClearSecurityScheme added in v0.8.5

func (c *Client) ClearSecurityScheme(securityScheme *auth.SecurityScheme) *Client

func (*Client) ClearSecuritySchemes added in v0.8.5

func (c *Client) ClearSecuritySchemes(securitySchemes []*auth.SecurityScheme) *Client

func (*Client) WithCookies added in v0.6.1

func (c *Client) WithCookies(cookies []*http.Cookie) *Client

func (*Client) WithHeader added in v0.7.2

func (c *Client) WithHeader(header http.Header) *Client

type NewClientOptions added in v0.6.1

type NewClientOptions struct {
	Timeout   time.Duration
	RateLimit int // requests per second
	ProxyURL  *url.URL

	Header  http.Header
	Cookies []*http.Cookie
}

type Request added in v0.3.1

type Request struct {
	Body        []byte
	Client      *Client
	HttpRequest *http.Request
}

func NewRequest added in v0.3.0

func NewRequest(method string, url string, body io.Reader, client *Client) (*Request, error)

func (*Request) AddCookie added in v0.8.3

func (r *Request) AddCookie(cookie *http.Cookie) *Request

func (*Request) AddHeader added in v0.8.3

func (r *Request) AddHeader(key string, value string) *Request

func (*Request) Do added in v0.3.1

func (r *Request) Do() (*Response, error)

func (*Request) GetBody added in v0.8.3

func (r *Request) GetBody() []byte

func (*Request) GetCookies added in v0.8.3

func (r *Request) GetCookies() []*http.Cookie

func (*Request) GetHeader added in v0.8.3

func (r *Request) GetHeader() http.Header

func (*Request) GetMethod added in v0.8.3

func (r *Request) GetMethod() string

func (*Request) GetURL added in v0.8.3

func (r *Request) GetURL() string

func (*Request) SetBody added in v0.8.3

func (r *Request) SetBody(body io.Reader) *Request

func (*Request) SetHeader added in v0.8.3

func (r *Request) SetHeader(key string, value string) *Request

func (*Request) WithCookies added in v0.6.1

func (r *Request) WithCookies(cookies []*http.Cookie) *Request

func (*Request) WithHeader added in v0.7.2

func (r *Request) WithHeader(header http.Header) *Request

func (*Request) WithSecurityScheme added in v0.3.1

func (r *Request) WithSecurityScheme(securityScheme *auth.SecurityScheme) *Request

type Response added in v0.8.3

type Response struct {
	Body         bytes.Buffer
	HttpResponse *http.Response
}

func NewResponse added in v0.8.3

func NewResponse(response *http.Response) (*Response, error)

func (*Response) GetBody added in v0.8.3

func (response *Response) GetBody() *bytes.Buffer

func (*Response) GetCookies added in v0.8.3

func (response *Response) GetCookies() []*http.Cookie

func (*Response) GetHeader added in v0.8.3

func (response *Response) GetHeader() http.Header

func (*Response) GetStatusCode added in v0.8.3

func (response *Response) GetStatusCode() int

Jump to

Keyboard shortcuts

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