Documentation
¶
Index ¶
- Variables
- type FileUploadMeta
- type HttpHeader
- type RequestHookFunc
- type Response
- func Delete(url string, options *HttpHeader) (*http.Request, *Response, error)
- func Get(url string, options *HttpHeader) (*http.Request, *Response, error)
- func Head(url string, options *HttpHeader) (*http.Request, *Response, error)
- func NewResponse(r *http.Response) (*Response, error)
- func Options(url string, options *HttpHeader) (*http.Request, *Response, error)
- func Patch(url string, options *HttpHeader) (*http.Request, *Response, error)
- func Post(url string, options *HttpHeader) (*http.Request, *Response, error)
- func Put(url string, options *HttpHeader) (*http.Request, *Response, error)
- type ResponseHookFunc
- type Session
- func (s *Session) AddRequestHooks(hooks ...RequestHookFunc) error
- func (s *Session) AddResponseHooks(hooks ...ResponseHookFunc) error
- func (s *Session) Delete(urlStr string, options *HttpHeader) (*http.Request, *Response, error)
- func (s *Session) Get(urlStr string, options *HttpHeader) (*http.Request, *Response, error)
- func (s *Session) Head(urlStr string, options *HttpHeader) (*http.Request, *Response, error)
- func (s *Session) Options(urlStr string, options *HttpHeader) (*http.Request, *Response, error)
- func (s *Session) Patch(urlStr string, options *HttpHeader) (*http.Request, *Response, error)
- func (s *Session) Post(urlStr string, options *HttpHeader) (*http.Request, *Response, error)
- func (s *Session) Put(urlStr string, options *HttpHeader) (*http.Request, *Response, error)
- func (s *Session) Request(method string, urlStr string, options *HttpHeader) (*http.Request, *Response, error)
- func (s *Session) ResetRequestHooks()
- func (s *Session) ResetResponseHooks()
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUnrecognizedEncoding = errors.New("unrecognized encoding string")
)
Functions ¶
This section is empty.
Types ¶
type FileUploadMeta ¶
type FileUploadMeta struct {
Data []byte // 文件内容
Src string // 文件路径
Name string // 文件名
MIME string // 文件类型 默认 application/octet-stream
}
FileUploadMeta 文件上传数据
func (*FileUploadMeta) SetMIME ¶
func (f *FileUploadMeta) SetMIME(mime string) *FileUploadMeta
SetMIME 设置文件类型
func (*FileUploadMeta) SetSrc ¶
func (f *FileUploadMeta) SetSrc(src string) *FileUploadMeta
SetSrc 设置文件路径
type HttpHeader ¶
type HttpHeader struct {
Params map[string]string // URL 查询参数
Data map[string]string // 表单数据
Headers map[string]string // 自定义请求头
Cookies map[string]string // Cookie设置
Auth map[string]string // Basic Auth 认证
JSON map[string]any // JSON 数据体
Files map[string]any // 文件上传字段
RowData string // 原始请求体
Proxy string // 代理地址
AllowRedirect bool // 是否允许重定向
Timeout int64 // 请求超时时间 单位-秒
Chunked bool // 是否启用 chunked 模式(不设置 Content-Length)
DisableKeepalives bool // 是否禁用 Keep-Alive
DisableCompression bool // 是否禁用压缩
SkipVerifyTLS bool // 是否跳过 TLS 验证
}
HttpHeader for request options
type RequestHookFunc ¶
RequestHookFunc request hook
type Response ¶
type Response struct {
*http.Response
Text string
Bytes []byte
// contains filtered or unexported fields
}
Response 响应对象 wrapper for http.Response
type ResponseHookFunc ¶
ResponseHookFunc response hook
type Session ¶
Session http session
func (*Session) AddRequestHooks ¶
func (s *Session) AddRequestHooks(hooks ...RequestHookFunc) error
AddRequestHooks 添加请求钩子函数
func (*Session) AddResponseHooks ¶
func (s *Session) AddResponseHooks(hooks ...ResponseHookFunc) error
AddResponseHooks 添加响应钩子函数
func (*Session) ResetRequestHooks ¶
func (s *Session) ResetRequestHooks()
ResetRequestHooks 重置请求钩子函数
func (*Session) ResetResponseHooks ¶
func (s *Session) ResetResponseHooks()
ResetResponseHooks 重置响应钩子函数
Click to show internal directories.
Click to hide internal directories.