httpclient

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientHttp

type ClientHttp struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *ClientHttp

func (*ClientHttp) ContentType

func (c *ClientHttp) ContentType(value string) *ClientHttp

func (*ClientHttp) Error

func (c *ClientHttp) Error() error

func (*ClientHttp) FormParams

func (c *ClientHttp) FormParams(obj map[string]interface{}) *ClientHttp

参数设置 表单请求支持json和form两种类型

func (*ClientHttp) Header

func (c *ClientHttp) Header(key, value string) *ClientHttp

func (*ClientHttp) ResetParam

func (c *ClientHttp) ResetParam() *ClientHttp

ResetParam 清空重置请求参数

func (*ClientHttp) RunGet

func (c *ClientHttp) RunGet(clientUrl string) (clientResp *ClientResp, err error)

RunGet 执行Get请求

func (*ClientHttp) RunPost

func (c *ClientHttp) RunPost(clientUrl string) (clientResp *ClientResp, err error)

RunGet 执行Post请求

func (*ClientHttp) SetTimeout

func (c *ClientHttp) SetTimeout(timeout int) *ClientHttp

func (*ClientHttp) WithBody

func (c *ClientHttp) WithBody(bodyStream string) *ClientHttp

直接传递body中的参数

func (*ClientHttp) WithCookie

func (c *ClientHttp) WithCookie() *ClientHttp

cookie保持 通过配置请求id将cookie保持

func (*ClientHttp) WithFormRequest

func (c *ClientHttp) WithFormRequest() *ClientHttp

WithFormRequest 快速配置表单请求类型

func (*ClientHttp) WithJsonRequest

func (c *ClientHttp) WithJsonRequest() *ClientHttp

WithFormRequest 快速配置表单请求类型

type ClientResp

type ClientResp struct {
	Body        []byte // response body
	BodyRaw     *http.Response
	RequestTime time.Duration
	CookieData  map[string]*http.Cookie
}

func (*ClientResp) GetRequestTime

func (c *ClientResp) GetRequestTime() time.Duration

func (*ClientResp) String

func (c *ClientResp) String() string

Jump to

Keyboard shortcuts

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