Documentation ¶
Index ¶
- func Download(url, filename string) (size int64, err error)
- type RequestWrapper
- func (r *RequestWrapper) AddHeader(key, value string) *RequestWrapper
- func (r *RequestWrapper) Exec() *RequestWrapper
- func (r *RequestWrapper) Json(data string) *RequestWrapper
- func (r *RequestWrapper) Param(key, value string) *RequestWrapper
- func (r *RequestWrapper) Pipe(w io.Writer) (written int64, err error)
- func (r *RequestWrapper) Query(query string) *RequestWrapper
- func (r *RequestWrapper) Response() (*http.Response, error)
- func (r *RequestWrapper) SetHeader(key, value string) *RequestWrapper
- func (r *RequestWrapper) SkipVerify() *RequestWrapper
- func (r *RequestWrapper) ToBytes() ([]byte, error)
- func (r *RequestWrapper) ToFile(filename string) (size int64, err error)
- func (r *RequestWrapper) ToString() (string, error)
- func (r *RequestWrapper) UseClient(client *http.Client) *RequestWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RequestWrapper ¶
type RequestWrapper struct {
// contains filtered or unexported fields
}
RequestWrapper 对http请求的封装
func NewNewRequestWithHttpReq ¶
func NewNewRequestWithHttpReq(req *http.Request) *RequestWrapper
func (*RequestWrapper) AddHeader ¶
func (r *RequestWrapper) AddHeader(key, value string) *RequestWrapper
func (*RequestWrapper) Json ¶
func (r *RequestWrapper) Json(data string) *RequestWrapper
Json 设置post请求的参数 body主体 `{"greeting":"hello world"}`
func (*RequestWrapper) Param ¶
func (r *RequestWrapper) Param(key, value string) *RequestWrapper
Param 添加url参数
func (*RequestWrapper) Pipe ¶
func (r *RequestWrapper) Pipe(w io.Writer) (written int64, err error)
Pipe 结果输出为io.Writer 返回length 以及error
func (*RequestWrapper) Query ¶
func (r *RequestWrapper) Query(query string) *RequestWrapper
func (*RequestWrapper) Response ¶
func (r *RequestWrapper) Response() (*http.Response, error)
返回response
func (*RequestWrapper) SetHeader ¶
func (r *RequestWrapper) SetHeader(key, value string) *RequestWrapper
SetHeader 设置header
func (*RequestWrapper) SkipVerify ¶
func (r *RequestWrapper) SkipVerify() *RequestWrapper
SkipVerify 忽略tls认证
func (*RequestWrapper) ToBytes ¶
func (r *RequestWrapper) ToBytes() ([]byte, error)
ToBytes 结果输出为[]byte
func (*RequestWrapper) ToFile ¶
func (r *RequestWrapper) ToFile(filename string) (size int64, err error)
ToFile 结果输出到文件
func (*RequestWrapper) ToString ¶
func (r *RequestWrapper) ToString() (string, error)
ToString 结果输出为string
func (*RequestWrapper) UseClient ¶
func (r *RequestWrapper) UseClient(client *http.Client) *RequestWrapper
UseClient 设置client
Click to show internal directories.
Click to hide internal directories.