Documentation
¶
Index ¶
- type Coookies
- type HttpSession
- func (httpx *HttpSession) Cookies(host string) Coookies
- func (httpx *HttpSession) Get(url string, headers http.Header, allowRedirects bool) (*http.Response, error)
- func (httpx *HttpSession) Post(url string, headers http.Header, data []byte, allowRedirects bool) (*http.Response, error)
- func (httpx *HttpSession) SetHeaders(headers http.Header)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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)
Click to show internal directories.
Click to hide internal directories.