gclient

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPContentType = "Content-Type"

	HTTPContentTypeUrlencoded     = "application/x-www-form-urlencoded"
	HTTPContentTypeUrlencodedUTF8 = "application/x-www-form-urlencoded; charset=utf-8"
	HTTPContentTypeJson           = "application/json"
	HTTPContentTypeJsonUTF8       = "application/json; charset=utf-8"
	HTTPContentTypeXml            = "application/xml"
	HTTPContentTypeXmlUTF8        = "application/xml; charset=utf-8"
	HTTPContentTypePlain          = "text/plain"
	HTTPContentTypePlainUTF8      = "text/plain; charset=utf-8"
	HTTPContentTypeHtml           = "text/html"
	HTTPContentTypeHtmlUTF8       = "text/html; charset=utf-8"
	HTTPContentTypeFormData       = "multipart/form-data"
	HTTPContentTypeFormDataUTF8   = "multipart/form-data; charset=utf-8"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(opts ...Option) *Client

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, url string, headers map[string]string) ([]byte, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, url string, headers map[string]string) ([]byte, error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, url string, body any, headers map[string]string) ([]byte, error)

func (*Client) Put

func (c *Client) Put(ctx context.Context, url string, body any, headers map[string]string) ([]byte, error)

type Option

type Option func(*Client)

func WithRetries

func WithRetries(retries int) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳