network

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadJar

func LoadJar(src string) http.CookieJar

LoadJar 加载 cookie jar

Types

type Client

type Client struct {
	LoginStatus bool
	CoreClient  http.Client
	UserAgent   string
}

Client 网络客户端

func NewClient

func NewClient() *Client

NewClient 创建新的客户端用于执行请求

func (*Client) DoGet

func (c *Client) DoGet(url string, params map[string]string) []byte

DoGet 执行GET请求

func (*Client) DoLoginGet

func (c *Client) DoLoginGet(url string, params map[string]string) []byte

DoLoginGet 用于登录的请求

func (*Client) DoPost

func (c *Client) DoPost(url string, req *http.Request, params Params, body []byte) []byte

DoPost 执行POST请求

func (*Client) DoPostForm

func (c *Client) DoPostForm(url string, req *http.Request, params Params, form PostForm, body []byte) []byte

DoPostForm 执行POSTFORM

func (*Client) LoadJar

func (c *Client) LoadJar(src string)

LoadJar 加载 cookie jar

func (*Client) NewRequest

func (c *Client) NewRequest(method string, headers Headers, url string, params Params, body []byte) *http.Request

NewRequest 创建新的请求

func (*Client) SaveJar

func (c *Client) SaveJar(jar http.CookieJar)

SaveJar 保存 cookie jar

type Headers

type Headers map[string]string

Headers 请求头列表

type Params

type Params map[string]string

Params 请求参数表

type PostForm

type PostForm map[string]string

PostForm PostForm表

Jump to

Keyboard shortcuts

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