net

package module
v0.0.0-...-e15b097 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) PUG/utils/net-latest Safari/537.36"

Variables

View Source
var DefaultClient = NewClient()

Functions

func BuildUrl

func BuildUrl(domain string, ssl bool, path string, params map[string]string) string

func GetBody

func GetBody(url string, headers Headers) ([]byte, error)

func GetJSON

func GetJSON(url string, headers Headers) (gjson.Result, error)

func PostBody

func PostBody(url string, headers Headers, body io.Reader) ([]byte, error)

func PostJSON

func PostJSON(url string, headers Headers, body io.Reader) (gjson.Result, error)

func PutBody

func PutBody(url string, headers Headers, body io.Reader) ([]byte, error)

func PutJSON

func PutJSON(url string, headers Headers, body io.Reader) (gjson.Result, error)

Types

type Client

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

func NewClient

func NewClient() *Client

func (*Client) Get

func (c *Client) Get(url string, headers Headers) (Response, error)

func (*Client) GetBody

func (c *Client) GetBody(url string, headers Headers) ([]byte, error)

func (*Client) GetJSON

func (c *Client) GetJSON(url string, headers Headers) (gjson.Result, error)

func (*Client) Post

func (c *Client) Post(url string, headers Headers, body io.Reader) (Response, error)

func (*Client) PostBody

func (c *Client) PostBody(url string, headers Headers, body io.Reader) ([]byte, error)

func (*Client) PostJSON

func (c *Client) PostJSON(url string, headers Headers, body io.Reader) (gjson.Result, error)

func (*Client) Put

func (c *Client) Put(url string, headers Headers, body io.Reader) (Response, error)

func (*Client) PutBody

func (c *Client) PutBody(url string, headers Headers, body io.Reader) ([]byte, error)

func (*Client) PutJSON

func (c *Client) PutJSON(url string, headers Headers, body io.Reader) (gjson.Result, error)

func (*Client) Request

func (c *Client) Request(method, url string, headers Headers, body io.Reader) (Response, error)

func (*Client) RequestBody

func (c *Client) RequestBody(method, url string, headers Headers, body io.Reader) ([]byte, error)

func (*Client) RequestJSON

func (c *Client) RequestJSON(method, url string, headers Headers, body io.Reader) (gjson.Result, error)

type Headers

type Headers map[string]string

type Response

type Response *http.Response

func Get

func Get(url string, headers Headers) (Response, error)

func Post

func Post(url string, headers Headers, body io.Reader) (Response, error)

func Put

func Put(url string, headers Headers, body io.Reader) (Response, error)

Jump to

Keyboard shortcuts

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