requests

package
v0.0.0-...-d2314f0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client contains request client

func New

func New(clients ...*http.Client) *Client

New create *Client

func (*Client) Get

func (r *Client) Get(url string, v ...interface{}) (*Response, error)

Get request

func (*Client) Post

func (r *Client) Post(url string, v ...interface{}) (*Response, error)

Post request

type Header map[string]string

Header represents http request header

type Query

type Query = url.Values

Query represents http request query param

type Response

type Response struct {
	Req *http.Request
	Res *http.Response
	// contains filtered or unexported fields
}

Response contains *http.Request and *http.Response

func (*Response) Bytes

func (r *Response) Bytes() ([]byte, error)

Bytes assign response body to resBody

func (*Response) String

func (r *Response) String() string

String format http request and response

func (*Response) ToFile

func (r *Response) ToFile(filename string) error

ToFile download response body to file

func (*Response) ToJSON

func (r *Response) ToJSON(v interface{}) error

ToJSON unmarshal response body to v

func (*Response) ToReader

func (r *Response) ToReader() io.Reader

ToReader return response body as io.Reader

func (*Response) ToString

func (r *Response) ToString() string

ToString return response body as string

Jump to

Keyboard shortcuts

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