http

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteCookie

func DeleteCookie(key string)

func DeleteCookies

func DeleteCookies(keys ...string)

func SetCookie

func SetCookie(key, value string)

func SetCookies

func SetCookies(cookies map[string]interface{})

func SetHeader

func SetHeader(key, value string)

func SetHeaders

func SetHeaders(headers map[string]interface{})

Types

type Body

type Body []byte

func (Body) String

func (body Body) String() string

type Options

type Options struct {
	Headers map[string]interface{}
	Cookies map[string]interface{}
}

type Request

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

func NewGET

func NewGET(url string) (*Request, error)

NewGET creates instance of http.Request with GET method.

func NewPOST

func NewPOST(url string, body io.Reader) (*Request, error)

NewPOST creates instance of http.Request with POST method.

func NewRequest

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

NewRequest creates instance of http.Request.

func (*Request) Send

func (req *Request) Send() (*Response, error)

Send sends a http request.

func (*Request) SetCookie

func (req *Request) SetCookie(key, value string)

func (*Request) SetCookies

func (req *Request) SetCookies(cookies map[string]interface{})

func (*Request) SetHeader

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

func (*Request) SetHeaders

func (req *Request) SetHeaders(headers map[string]interface{})

type Response

type Response struct {
	Body       Body
	Cookies    []*http.Cookie
	Header     http.Header
	StatusCode int
}

func Get

func Get(url string, options *Options) (*Response, error)

Get sends a GET http request.

func Post

func Post(url string, options *Options, body io.Reader) (*Response, error)

Post sends a POST http request.

func Send

func Send(method, url string, options *Options, body io.Reader) (*Response, error)

Send sends a http request.

Jump to

Keyboard shortcuts

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