gtgo_http

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

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 RequestGet(url string, successFunc func(respData []byte), errorFuc func())

func RequestPost

func RequestPost(url string, data []byte, successFunc func(respData []byte), errorFuc func())

func RequestPostWithBasicAuth

func RequestPostWithBasicAuth(url string, authName string, authPwd string, data []byte, successFunc func(respData []byte), errorFuc func())

Types

type GTToolsHttpRequest

type GTToolsHttpRequest struct {
	HttpClient          *http.Client
	CurrentRequest      *http.Request
	CurrentResponse     *http.Response
	CurrentResponseBody []byte
	CurrentError        error
}

func Instance

func Instance() *GTToolsHttpRequest

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) ToRequest

func (httpReq *GTToolsHttpRequest) ToRequest(url string, authName string, authPwd string, method string, data []byte, successFunc func(respData []byte), errorFuc func())

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())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL