httpclient

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(baseURL string, config ...Config) (*Client, error)

func (*Client) Delete

func (h *Client) Delete(ctx context.Context, path string, reqOptions RequestOptions) (*HttpResponse, error)

func (*Client) Do

func (h *Client) Do(ctx context.Context, method, path string, reqOptions RequestOptions) (*HttpResponse, error)

func (*Client) Get

func (h *Client) Get(ctx context.Context, path string, reqOptions RequestOptions) (*HttpResponse, error)

func (*Client) Patch

func (h *Client) Patch(ctx context.Context, path string, reqOptions RequestOptions) (*HttpResponse, error)

func (*Client) Post

func (h *Client) Post(ctx context.Context, path string, reqOptions RequestOptions) (*HttpResponse, error)

func (*Client) Put

func (h *Client) Put(ctx context.Context, path string, reqOptions RequestOptions) (*HttpResponse, error)

type Config

type Config struct {
	// Enable debug mode
	Debug bool

	// Default headers
	Headers map[string]string
}

type HttpResponse

type HttpResponse struct {
	URL string
	fasthttp.Response
}

func (*HttpResponse) UnmarshalBody

func (r *HttpResponse) UnmarshalBody(out any) error

type RequestOptions

type RequestOptions struct {
	Body     []byte
	Query    url.Values
	Header   map[string]string
	FormData url.Values
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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