Documentation ¶
Index ¶
- Variables
- func RequestGet(url string, successFunc func(respData []byte), errorFuc func())
- func RequestPost(url string, data []byte, successFunc func(respData []byte), errorFuc func())
- func RequestPostWithBasicAuth(url string, authName string, authPwd string, data []byte, ...)
- type GTToolsHttpRequest
- func (httpReq *GTToolsHttpRequest) DownFile(Url string, savePath string, successFunc func(), errorFuc func())
- func (httpReq *GTToolsHttpRequest) SetUp()
- func (httpReq *GTToolsHttpRequest) ToRequest(url string, authName string, authPwd string, method string, data []byte, ...)
- func (httpReq *GTToolsHttpRequest) ToRequestGet(url string, successFunc func(respData []byte), errorFuc func())
- func (httpReq *GTToolsHttpRequest) ToRequestPost(url string, data []byte, successFunc func(respData []byte), errorFuc func())
Constants ¶
This section is empty.
Variables ¶
View Source
var ( HttpRequest *GTToolsHttpRequest Once sync.Once UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36" )
Functions ¶
func RequestGet ¶
func RequestPost ¶
RequestPost POST请求
Types ¶
type GTToolsHttpRequest ¶
type GTToolsHttpRequest struct { HttpClient *http.Client CurrentRequest *http.Request CurrentResponse *http.Response CurrentResponseBody []byte CurrentError error }
func (*GTToolsHttpRequest) DownFile ¶
func (httpReq *GTToolsHttpRequest) DownFile(Url string, savePath string, successFunc func(), errorFuc func())
DownFile 通过Http下载文件
func (*GTToolsHttpRequest) SetUp ¶
func (httpReq *GTToolsHttpRequest) SetUp()
func (*GTToolsHttpRequest) ToRequestGet ¶
func (httpReq *GTToolsHttpRequest) ToRequestGet(url string, successFunc func(respData []byte), errorFuc func())
func (*GTToolsHttpRequest) ToRequestPost ¶
func (httpReq *GTToolsHttpRequest) ToRequestPost(url string, data []byte, successFunc func(respData []byte), errorFuc func())
Click to show internal directories.
Click to hide internal directories.