webclient

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyUrl = errors.New("empty url")

	ErrEmptyFile = errors.New("empty file")
)

Functions

func NewClientPool

func NewClientPool() sync.Pool

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func (*Client) AddBodyByte

func (c *Client) AddBodyByte(body []byte) *Client

func (*Client) AddBodyBytes

func (c *Client) AddBodyBytes(bodyBytes []byte) *Client

func (*Client) AddBodyStruct

func (c *Client) AddBodyStruct(object interface{}) *Client

func (*Client) AddCookie

func (c *Client) AddCookie(key, value string) *Client

func (*Client) AddCookies

func (c *Client) AddCookies(cookies Mapper) *Client

func (*Client) AddFile

func (c *Client) AddFile(fileName, filePath string) *Client

func (*Client) AddFiles

func (c *Client) AddFiles(files Mapper) *Client

func (*Client) AddHeader

func (c *Client) AddHeader(key, value string) *Client

func (*Client) AddHeaders

func (c *Client) AddHeaders(headers Mapper) *Client

func (*Client) AddParam

func (c *Client) AddParam(key, value string) *Client

func (*Client) AddParams

func (c *Client) AddParams(params Mapper) *Client

func (*Client) Get

func (c *Client) Get(rawUrl string) (*Response, error)

func (*Client) Post

func (c *Client) Post(url string) (*Response, error)

func (*Client) SendFile

func (c *Client) SendFile(url string, options ...RequestOption) (*Response, error)

func (*Client) SetCrt

func (c *Client) SetCrt(certPath, keyPath string) *Client

func (*Client) SetProxy

func (c *Client) SetProxy(proxy string) *Client

func (*Client) SetTimeout

func (c *Client) SetTimeout(duration time.Duration) *Client

type Mapper

type Mapper map[string]string

func NewCookies

func NewCookies() Mapper

func NewFiles

func NewFiles() Mapper

func NewHeaders

func NewHeaders() Mapper

func NewParams

func NewParams() Mapper

func (Mapper) Get

func (m Mapper) Get(key string) string

func (Mapper) Set

func (m Mapper) Set(key, value string) Mapper

type RequestCookies

type RequestCookies struct{ Mapper }

type RequestFiles

type RequestFiles struct{ Mapper }

type RequestHeaders

type RequestHeaders struct{ Mapper }

type RequestOption

type RequestOption struct {
	// contains filtered or unexported fields
}

type RequestParams

type RequestParams struct{ Mapper }

type Response

type Response struct {
	StatusCode int
	Body       []byte
	Header     RequestHeaders
	Cookie     RequestCookies
}

Jump to

Keyboard shortcuts

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