rs

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GET  = "GET"
	POST = "POST"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

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

func Get

func Get(uri string) *Request

生成GET请求

func NewRequest

func NewRequest() *Request

func Post

func Post(uri string) *Request

生成GET请求

func (*Request) AddParam added in v1.0.2

func (r *Request) AddParam(key, value string) *Request

增加一个请求参数

func (*Request) AddParams added in v1.0.2

func (r *Request) AddParams(param map[string]string) *Request

增加多个请求参数

func (*Request) BasicAuth added in v1.0.4

func (r *Request) BasicAuth(user, password string) *Request

对请求设置basic auth信息

func (*Request) Proxy

func (r *Request) Proxy(proxy string) *Request

设置请求代理地址

func (*Request) ReadText

func (r *Request) ReadText() string

将结果请求读取为字符串

func (*Request) Send

func (r *Request) Send() *Request

建立请求, 并将数据发送给服务器

func (*Request) SetConnTimeOut

func (r *Request) SetConnTimeOut(time int) *Request

设置建立连接的超时时间

func (*Request) SetHeadTimeOut added in v1.0.3

func (r *Request) SetHeadTimeOut(time int) *Request

设置请求头的超时时间 已废弃: 请使用 SetRespTimeOut 来替代 SetHeadTimeOut 方法 Deprecated: use SetRespTimeOut replace SetHeadTimeOut

func (*Request) SetRespTimeOut

func (r *Request) SetRespTimeOut(time int) *Request

设置相应请求的超时时间

func (*Request) SetTimeOut

func (r *Request) SetTimeOut(time int) *Request

设置超时时间

func (*Request) WriteToFile

func (r *Request) WriteToFile(path string)

将结果请求写入到文件

type Requests

type Requests interface {
	// 发送
	Send()
	// 代理
	Proxy()
	// 读取返回流为文本
	ReadText()
	// 将返回流输出文本, 写入到文件
	WriteToFile()
	// 读取成byte流
	ReadByte()
	// 设置请求参数
	SetParams()
	// 设置请求头
	SetHeader()
	// 设置超时时间
	SetTimeOut()
	// 设置Cookie
	SetCookie()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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