Documentation ¶
Index ¶
- func InitAsyncPool(poolSize int)
- type ErrorMessage
- type HttpRequest
- func (req *HttpRequest) AddHeader(header, val string) *HttpRequest
- func (req *HttpRequest) Response() ([]byte, error)
- func (req *HttpRequest) Result() (*HttpResponse, error)
- func (req *HttpRequest) SetAsync(on bool) *HttpRequest
- func (req *HttpRequest) SetContentType(typeStr string) *HttpRequest
- func (req *HttpRequest) SetCookies(cookies map[string]string) *HttpRequest
- func (req *HttpRequest) SetFormBody(body map[string]interface{}) *HttpRequest
- func (req *HttpRequest) SetFormDataBody(body map[string]interface{}) *HttpRequest
- func (req *HttpRequest) SetHeaders(headers map[string]string) *HttpRequest
- func (req *HttpRequest) SetMethod(method string) *HttpRequest
- func (req *HttpRequest) SetQueries(queries map[string]string) *HttpRequest
- func (req *HttpRequest) SetRawBody(body []byte) *HttpRequest
- func (req *HttpRequest) SetTimeout(timeout time.Duration) *HttpRequest
- func (req *HttpRequest) SetTracing(span opentracing.Span) *HttpRequest
- func (req *HttpRequest) Unmarshal(data interface{}) error
- type HttpResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorMessage ¶ added in v1.0.15
type HttpRequest ¶
type HttpRequest struct {
// contains filtered or unexported fields
}
func (*HttpRequest) AddHeader ¶
func (req *HttpRequest) AddHeader(header, val string) *HttpRequest
AddHeader 增加一个Header
func (*HttpRequest) Response ¶
func (req *HttpRequest) Response() ([]byte, error)
Response 原始http请求(返回byte)
func (*HttpRequest) Result ¶
func (req *HttpRequest) Result() (*HttpResponse, error)
Result http请求 返回封装
func (*HttpRequest) SetContentType ¶
func (req *HttpRequest) SetContentType(typeStr string) *HttpRequest
SetContentType 设置ContentType
func (*HttpRequest) SetCookies ¶
func (req *HttpRequest) SetCookies(cookies map[string]string) *HttpRequest
SetCookies 设置cookies
func (*HttpRequest) SetFormBody ¶
func (req *HttpRequest) SetFormBody(body map[string]interface{}) *HttpRequest
SetFormBody 设置
func (*HttpRequest) SetFormDataBody ¶
func (req *HttpRequest) SetFormDataBody(body map[string]interface{}) *HttpRequest
SetFormDataBody 设置文件上传 文件路径名map/文件二进制内容map
func (*HttpRequest) SetHeaders ¶
func (req *HttpRequest) SetHeaders(headers map[string]string) *HttpRequest
SetHeaders 设置Headers
func (*HttpRequest) SetMethod ¶
func (req *HttpRequest) SetMethod(method string) *HttpRequest
SetMethod 设置Http请求方法
func (*HttpRequest) SetQueries ¶
func (req *HttpRequest) SetQueries(queries map[string]string) *HttpRequest
SetQueries 设置url携带的数据
func (*HttpRequest) SetRawBody ¶
func (req *HttpRequest) SetRawBody(body []byte) *HttpRequest
SetRawBody raw参数
func (*HttpRequest) SetTimeout ¶
func (req *HttpRequest) SetTimeout(timeout time.Duration) *HttpRequest
SetTimeout 设置超时
func (*HttpRequest) SetTracing ¶
func (req *HttpRequest) SetTracing(span opentracing.Span) *HttpRequest
SetTracing 设置追踪
func (*HttpRequest) Unmarshal ¶
func (req *HttpRequest) Unmarshal(data interface{}) error
Unmarshal HTTP请求(填充data结构体信息)
type HttpResponse ¶
type HttpResponse struct { Success bool `json:"success"` Data interface{} `json:"data"` Error ErrorMessage `json:"error"` }
Click to show internal directories.
Click to hide internal directories.