http

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type C added in v0.2.21

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

func Client

func Client(setting Setting) *C

Client 获取客户端

func (C) Request added in v0.2.21

func (c C) Request() R

func (C) SetTimeout added in v0.2.21

func (c C) SetTimeout(time time.Duration) C

SetTimeout 设置超时时间

type R added in v0.2.21

type R struct {
	Request   *http.Request
	Parameter map[string]interface{} //参数

	Header map[string]string //header
	// contains filtered or unexported fields
}

R request构造体

func (R) DownloadFile added in v0.2.21

func (r R) DownloadFile(url string, path string) error

DownloadFile 下载文件

func (R) DownloadImage added in v0.2.21

func (r R) DownloadImage(url string, path string) error

DownloadImage 图片下载

func (R) GetToBody added in v0.2.21

func (r R) GetToBody(url string) (io.ReadCloser, error)

GetToBody 注意要手动关闭body

func (R) GetToResp added in v0.2.21

func (r R) GetToResp(url string) (*http.Response, error)

GetToResp 注意要手动关闭body

func (R) GetToString added in v0.2.21

func (r R) GetToString(url string) (string, error)

func (R) GetToStringWithHeader added in v0.2.21

func (r R) GetToStringWithHeader(url string) (string, http.Header, error)

GetToStringWithHeader get获取字符串结果并返回头部信息

func (R) PostToString added in v0.2.21

func (r R) PostToString(url string) (string, error)

PostToString post获取字符串结果

func (R) SetParameter added in v0.2.21

func (r R) SetParameter(p map[string]interface{}) R

SetParameter 设置请求参数

type Setting added in v0.2.21

type Setting struct {
	TimeOut      time.Duration //超时时间
	ProxyAddress string        //代理地址
}

Jump to

Keyboard shortcuts

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