httpclient

package
v0.0.0-...-2c5f5e2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calling

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

func Delete

func Delete(url string, otherParams ...interface{}) (*Calling, error)

func DoMethod

func DoMethod(method Method, url string, otherParams ...interface{}) (*Calling, error)

*

  • otherParams type: []byte: body | string: body | io.Reader: body | context.Context: | http.Header | Option

func Get

func Get(url string, otherParams ...interface{}) (*Calling, error)

func New

func New(url ...string) *Calling

func Post

func Post(url string, otherParams ...interface{}) (*Calling, error)

func Put

func Put(url string, otherParams ...interface{}) (*Calling, error)

func (*Calling) Body

func (c *Calling) Body() io.Reader

func (*Calling) Client

func (c *Calling) Client() *http.Client

func (*Calling) Context

func (c *Calling) Context() context.Context

func (*Calling) Cookies

func (c *Calling) Cookies() []*http.Cookie

func (*Calling) Do

func (c *Calling) Do(ctx ...context.Context) error

func (*Calling) GetRespBody

func (c *Calling) GetRespBody() ([]byte, error)

func (*Calling) GetRespBodyString

func (c *Calling) GetRespBodyString() (string, error)

func (*Calling) GetRespCookies

func (c *Calling) GetRespCookies() []*http.Cookie

func (*Calling) GetRespHeader

func (c *Calling) GetRespHeader() http.Header

func (*Calling) GetRespStatusCode

func (c *Calling) GetRespStatusCode() int

func (*Calling) GetRespStatusIsOK

func (c *Calling) GetRespStatusIsOK() bool

func (*Calling) GetResponse

func (c *Calling) GetResponse() *http.Response

func (*Calling) Header

func (c *Calling) Header() http.Header

func (*Calling) HeaderByKey

func (c *Calling) HeaderByKey(key string) string

func (*Calling) Method

func (c *Calling) Method() Method

func (*Calling) Option

func (c *Calling) Option() *Option

func (*Calling) ReDo

func (c *Calling) ReDo(ctx ...context.Context) error

func (*Calling) Request

func (c *Calling) Request() *http.Request

func (*Calling) TimeExpend

func (c *Calling) TimeExpend() time.Duration

func (*Calling) Url

func (c *Calling) Url() *url.URL

func (*Calling) WithBody

func (c *Calling) WithBody(body interface{}) *Calling

func (*Calling) WithClient

func (c *Calling) WithClient(client *http.Client) *Calling

func (*Calling) WithContext

func (c *Calling) WithContext(ctx context.Context) *Calling

func (*Calling) WithCookie

func (c *Calling) WithCookie(cookie *http.Cookie) *Calling

func (*Calling) WithHeader

func (c *Calling) WithHeader(headers ...interface{}) *Calling

func (*Calling) WithMethod

func (c *Calling) WithMethod(method Method) *Calling

func (*Calling) WithOption

func (c *Calling) WithOption(opt *Option) *Calling

func (*Calling) WithRequest

func (c *Calling) WithRequest(request *http.Request) *Calling

func (*Calling) WithUrl

func (c *Calling) WithUrl(u interface{}) *Calling

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type Method

type Method = string
const (
	GET    Method = "GET"
	POST   Method = "POST"
	PUT    Method = "PUT"
	DELETE Method = "DELETE"
)

type Option

type Option struct {
	Timeout *time.Duration
}

func NewOption

func NewOption() *Option

func (*Option) SetTimeout

func (o *Option) SetTimeout(timout time.Duration) *Option

Jump to

Keyboard shortcuts

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