resty

package
v0.0.0-...-e225f37 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogDirName

func GetLogDirName(protocol, baseDir string, url *url.URL) (string, error)

func GetLogFName

func GetLogFName(protocol, baseDir string, method string, url *url.URL, fext string) (string, error)

Types

type Client

type Client interface {
	InsecureSkipHttpsVerify() Client
	SetTLSClientConfig(tlsCfg *tls.Config) Client
	Request() Request
	GetClient() *http.Client
}

func NewLoggingNetClient

func NewLoggingNetClient(writeLogDir string) Client

func NewMockNetClient

func NewMockNetClient(readLogDir string) Client

func NewNetClient

func NewNetClient() Client

type NetClient

type NetClient struct {
	*resty.Client
	// contains filtered or unexported fields
}

func (*NetClient) GetClient

func (nc *NetClient) GetClient() *http.Client

func (*NetClient) InsecureSkipHttpsVerify

func (nc *NetClient) InsecureSkipHttpsVerify() Client

func (*NetClient) Request

func (nc *NetClient) Request() Request

func (*NetClient) SetTLSClientConfig

func (nc *NetClient) SetTLSClientConfig(tlsCfg *tls.Config) Client

type NetRequest

type NetRequest struct {
	*resty.Request
	// contains filtered or unexported fields
}

func (*NetRequest) AddHeaders

func (nrq *NetRequest) AddHeaders(headers http.Header) Request

func (*NetRequest) Do

func (nrq *NetRequest) Do(method, urlS string) (Response, error)

func (*NetRequest) Get

func (nrq *NetRequest) Get(url string) (Response, error)

func (*NetRequest) Post

func (nrq *NetRequest) Post(url string) (Response, error)

func (*NetRequest) SetBody

func (nrq *NetRequest) SetBody(body interface{}) Request

func (*NetRequest) SetBodyJson

func (nrq *NetRequest) SetBodyJson(body interface{}) Request

func (*NetRequest) SetCookie

func (nrq *NetRequest) SetCookie(name, value string) Request

func (*NetRequest) SetHeader

func (nrq *NetRequest) SetHeader(key string, value string) Request

func (*NetRequest) SetHeaders

func (nrq *NetRequest) SetHeaders(headersM map[string]string) Request

func (*NetRequest) SetProtocol

func (nrq *NetRequest) SetProtocol(prot string) Request

type NetResponse

type NetResponse struct {
	*resty.Response
}

func (*NetResponse) Body

func (nrs *NetResponse) Body() []byte

func (*NetResponse) BodyString

func (nrs *NetResponse) BodyString() string

func (*NetResponse) DeJSON

func (nrs *NetResponse) DeJSON(tgtData interface{}) error

func (*NetResponse) Header

func (nrs *NetResponse) Header() http.Header

func (*NetResponse) Status

func (nrs *NetResponse) Status() string

func (*NetResponse) StatusCode

func (nrs *NetResponse) StatusCode() int

type Request

type Request interface {
	Get(url string) (Response, error)
	Post(url string) (Response, error)
	Do(method, url string) (Response, error)
	SetProtocol(prot string) Request
	SetHeader(key string, value string) Request
	AddHeaders(headers http.Header) Request
	SetHeaders(headersM map[string]string) Request
	SetCookie(name, value string) Request
	SetBody(body interface{}) Request
	SetBodyJson(body interface{}) Request
}

type Response

type Response interface {
	StatusCode() int
	Status() string
	Body() []byte
	BodyString() string
	Header() http.Header
	DeJSON(tgtData interface{}) error
}

Jump to

Keyboard shortcuts

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