Documentation ¶
Index ¶
- func GetUserAgent() string
- type FormFile
- type FormFiles
- type HttpRequest
- func (s *HttpRequest) Delete(url string) (IHttpResponse, error)
- func (s *HttpRequest) Get(url string) (IHttpResponse, error)
- func (s *HttpRequest) Post(url string) (IHttpResponse, error)
- func (s *HttpRequest) Put(url string) (IHttpResponse, error)
- func (s *HttpRequest) SetCookies(cookies map[string]string)
- func (s *HttpRequest) SetData(data map[string]string)
- func (s *HttpRequest) SetFiles(files FormFiles)
- func (s *HttpRequest) SetHeaders(headers map[string]string)
- func (s *HttpRequest) SetJson(json interface{})
- func (s *HttpRequest) SetParams(params map[string]string)
- func (s *HttpRequest) SetUserAgent(userAgent string)
- type HttpResponse
- type IHttpRequest
- type IHttpResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUserAgent ¶
func GetUserAgent() string
Types ¶
type FormFiles ¶
type FormFiles []FormFile
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http表单文件数据结构 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type HttpRequest ¶
type HttpRequest struct {
// contains filtered or unexported fields
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http请求数据结构 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) Delete ¶
func (s *HttpRequest) Delete(url string) (IHttpResponse, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Delete请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) Get ¶
func (s *HttpRequest) Get(url string) (IHttpResponse, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Get请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) Post ¶
func (s *HttpRequest) Post(url string) (IHttpResponse, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Post请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) Put ¶
func (s *HttpRequest) Put(url string) (IHttpResponse, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Put请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetCookies ¶
func (s *HttpRequest) SetCookies(cookies map[string]string)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置Cookie * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetData ¶
func (s *HttpRequest) SetData(data map[string]string)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置字典数据 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetFiles ¶
func (s *HttpRequest) SetFiles(files FormFiles)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置文件数据 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetHeaders ¶
func (s *HttpRequest) SetHeaders(headers map[string]string)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置头 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetJson ¶
func (s *HttpRequest) SetJson(json interface{})
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置Json数据 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetParams ¶
func (s *HttpRequest) SetParams(params map[string]string)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置参数 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetUserAgent ¶
func (s *HttpRequest) SetUserAgent(userAgent string)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置用户代理http头 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type HttpResponse ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http响应数据结构 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpResponse) GetData ¶
func (s *HttpResponse) GetData() []byte
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取请求内容 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpResponse) GetHeader ¶
func (s *HttpResponse) GetHeader() http.Header
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取请求头 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpResponse) GetStatus ¶
func (s *HttpResponse) GetStatus() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取状态描述 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpResponse) GetStatusCode ¶
func (s *HttpResponse) GetStatusCode() int
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取状态码 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type IHttpRequest ¶
type IHttpRequest interface { Get(url string) (IHttpResponse, error) Post(url string) (IHttpResponse, error) Put(url string) (IHttpResponse, error) Delete(url string) (IHttpResponse, error) SetUserAgent(userAgent string) SetHeaders(headers map[string]string) SetParams(params map[string]string) SetCookies(cookies map[string]string) SetJson(json interface{}) SetData(data map[string]string) SetFiles(files FormFiles) }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http请求接口 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func NewHttpRequest ¶
func NewHttpRequest() IHttpRequest
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 初始化Http请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type IHttpResponse ¶
type IHttpResponse interface { GetData() []byte GetHeader() http.Header GetStatusCode() int GetStatus() string }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http响应接口 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++