clienthttp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient interface {
	Request(ctx context.Context, method string, url string, options ...RequestOptions) (*Response, error)
}

func NewHTTPClient

func NewHTTPClient(baseURL string) HTTPClient

type RequestOptions

type RequestOptions func(req *http.Request)

func WithPayload

func WithPayload(v any) RequestOptions

func WithQueryParams

func WithQueryParams(params url.Values) RequestOptions

func WithToken

func WithToken(token string) RequestOptions

func WithUserAgent

func WithUserAgent(userAgent string) RequestOptions

type Response

type Response struct {
	Content  []byte
	Response *http.Response
}

func (*Response) Bind

func (r *Response) Bind(v interface{}) error

func (*Response) Error

func (r *Response) Error() error

Jump to

Keyboard shortcuts

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