httpx

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coookies

type Coookies []*http.Cookie

func (Coookies) Get

func (c Coookies) Get(name string) (string, bool)

func (Coookies) Set

func (c Coookies) Set(name string, val string) bool

type HttpSession

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

HttpSession 封装了 http.Client,实现了会话保持和 headers 的传递

func NewHttpSession

func NewHttpSession(timeout time.Duration) (*HttpSession, error)

NewHttpSessionClient 返回一个新的 HttpSessionClient 实例

func (*HttpSession) Cookies

func (httpx *HttpSession) Cookies(host string) Coookies

Cookies returns the value of a cookie

func (*HttpSession) Get

func (httpx *HttpSession) Get(url string, headers http.Header, allowRedirects bool) (*http.Response, error)

Get 发送 GET 请求

func (*HttpSession) Post

func (httpx *HttpSession) Post(url string, headers http.Header, data []byte, allowRedirects bool) (*http.Response, error)

Post 发送 POST 请求

func (*HttpSession) SetHeaders

func (httpx *HttpSession) SetHeaders(headers http.Header)

Jump to

Keyboard shortcuts

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