httpclient

package
v0.5.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = fasthttp.Client{
	MaxConnsPerHost: 10240,
	ReadBufferSize:  4 * 1024,
	WriteBufferSize: 4 * 1024,
}

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) BaseURL added in v0.2.5

func (h *Client) BaseURL() *url.URL

BaseURL returns the cloned base URL of the client.

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