tool

package module
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: MIT Imports: 20 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cookie cookie
View Source
var File file
View Source
var Rand ranD
View Source
var Regexp reg
View Source
var Time timE

Functions

func GenHttpClient added in v0.6.4

func GenHttpClient(opt *HttpClientOptions) *http.Client

func GenHttpTransport added in v0.6.4

func GenHttpTransport(opt *HttpTransportOptions) *http.Transport

func Recover added in v0.6.2

func Recover()

Types

type DoHttpReq added in v0.6.4

type DoHttpReq struct {
	Url    string
	Header map[string]interface{}
	Query  map[string]interface{}
	Body   interface{}
	Cookie map[string]string
}

type Http added in v0.6.4

type Http struct {
	Client *http.Client
}

func NewHttpTool added in v0.6.4

func NewHttpTool(c *http.Client) *Http

func (*Http) GenReq added in v0.6.4

func (a *Http) GenReq(Type string, opt *DoHttpReq) (*http.Request, error)

func (*Http) Get added in v0.6.4

func (a *Http) Get(opt *DoHttpReq) (*http.Response, map[string]interface{}, error)

Get 表单请求快捷方式

func (*Http) GetBytes added in v0.6.4

func (a *Http) GetBytes(opt *DoHttpReq) (*http.Response, []byte, error)

func (*Http) GetRequest added in v0.6.4

func (a *Http) GetRequest(opt *DoHttpReq) (*http.Response, error)

func (*Http) GetString added in v0.6.4

func (a *Http) GetString(opt *DoHttpReq) (*http.Response, string, error)

func (*Http) Post added in v0.6.4

func (a *Http) Post(opt *DoHttpReq) (*http.Response, map[string]interface{}, error)

Post 表单请求快捷方式

func (*Http) PostBytes added in v0.6.4

func (a *Http) PostBytes(opt *DoHttpReq) (*http.Response, []byte, error)

func (*Http) PostRequest added in v0.6.4

func (a *Http) PostRequest(opt *DoHttpReq) (*http.Response, error)

func (*Http) PostString added in v0.6.4

func (a *Http) PostString(opt *DoHttpReq) (*http.Response, string, error)

func (*Http) PrepareRequest added in v0.6.4

func (a *Http) PrepareRequest(Type string, opt *DoHttpReq) (*HttpRequest, error)

func (*Http) ReadResBodyToByte added in v0.6.4

func (*Http) ReadResBodyToByte(i io.ReadCloser) ([]byte, error)

func (*Http) ReadResBodyToString added in v0.6.4

func (a *Http) ReadResBodyToString(i io.ReadCloser) (string, error)

func (*Http) Request added in v0.6.4

func (a *Http) Request(Type string, opt *DoHttpReq) (*http.Response, error)

func (*Http) UnMarshalResBodyToMap added in v0.6.4

func (a *Http) UnMarshalResBodyToMap(i io.ReadCloser) (map[string]interface{}, error)

type HttpClientOptions added in v0.6.4

type HttpClientOptions struct {
	Transport *http.Transport
	//禁止跟随重定向
	NoRedirect bool
	//启用 cookiejar
	RedirectCookieJar bool
	//超时时间
	Timeout time.Duration
}

type HttpRequest added in v0.6.4

type HttpRequest struct {
	Req *http.Request
	// contains filtered or unexported fields
}

func (*HttpRequest) Do added in v0.6.4

func (a *HttpRequest) Do() (*http.Response, error)

type HttpTransportOptions added in v0.6.4

type HttpTransportOptions struct {
	Timeout           time.Duration
	LocalAddr         net.Addr
	IdleConnTimeout   time.Duration
	SkipSslCertVerify bool
}

Jump to

Keyboard shortcuts

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