client

package
v0.0.0-...-9101f62 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New() (*Client, error)

func NewWithOptions

func NewWithOptions(opts Options) (*Client, error)

func (Client) Do

func (c Client) Do(req *Request) (*Response, error)

func (Client) NewRequest

func (c Client) NewRequest(method, urlString string) (*Request, error)

func (Client) NewRequestWithContext

func (c Client) NewRequestWithContext(ctx context.Context, method, urlString string) (*Request, error)

type Options

type Options struct {
	BaseUrl          *url.URL
	BaseUrlString    string
	Timeout          time.Duration
	Header           http.Header
	RetryOpts        retry.Options
	IncludeCookieJar bool
}

type Request

type Request struct {
	*http.Request
}

func (Request) GetHttpRequest

func (req Request) GetHttpRequest() *http.Request

func (*Request) SetBody

func (req *Request) SetBody(body io.Reader)

func (*Request) SetBodyForm

func (req *Request) SetBodyForm(data url.Values)

func (*Request) SetBodyJson

func (req *Request) SetBodyJson(body any) error

type Response

type Response struct {
	*http.Response
}

func (Response) BindBodyJson

func (resp Response) BindBodyJson(v any) error

func (Response) GetBodyString

func (resp Response) GetBodyString() (string, error)

func (Response) GetHttpResponse

func (resp Response) GetHttpResponse() *http.Response

Jump to

Keyboard shortcuts

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