Documentation ¶
Index ¶
- Constants
- Variables
- func DELETE(url string, opt ...RequestOptions) (*http.Response, error)
- func GET(url string, opt ...RequestOptions) (*http.Response, error)
- func HEAD(url string, opt ...RequestOptions) (*http.Response, error)
- func OPTIONS(url string, opt ...RequestOptions) (*http.Response, error)
- func PATCH(url string, opt ...RequestOptions) (*http.Response, error)
- func POST(url string, opt ...RequestOptions) (*http.Response, error)
- func PUT(url string, opt ...RequestOptions) (*http.Response, error)
- func Request(url string, opts ...RequestOptions) (*http.Response, error)
- func ToObject[T any](resp *http.Response, err error) (*T, *http.Response, error)
- func ToString(resp *http.Response, err error) (string, *http.Response, error)
- type Client
- func (cli *Client) DELETE(url string, opt ...RequestOptions) (*http.Response, error)
- func (cli *Client) GET(url string, opt ...RequestOptions) (*http.Response, error)
- func (cli *Client) HEAD(url string, opt ...RequestOptions) (*http.Response, error)
- func (cli *Client) OPTIONS(url string, opt ...RequestOptions) (*http.Response, error)
- func (cli *Client) PATCH(url string, opt ...RequestOptions) (*http.Response, error)
- func (cli *Client) POST(url string, opt ...RequestOptions) (*http.Response, error)
- func (cli *Client) PUT(url string, opt ...RequestOptions) (*http.Response, error)
- func (cli *Client) Request(url string, opt ...RequestOptions) (*http.Response, error)
- type Config
- type RequestOptions
Constants ¶
View Source
const ( // RequestTimeoutDefault is the default timeout for request. RequestTimeoutDefault int = 1000 // RequestTimeoutNone means no timeout limitation. RequestTimeoutNone int = -1 )
Variables ¶
View Source
var ErrNoURL error = errors.New("no url")
ErrNoURL throws when no uri and base url set in the request.
View Source
var ErrUnsupportedContentType = errors.New("unsupported content type")
Functions ¶
Types ¶
type Client ¶
type Client struct { // BaseURL will be prepended to all request URL unless URL is absolute. BaseURL string // Headers are custom headers to be sent. Headers map[string][]string // contains filtered or unexported fields }
type Config ¶
type Config struct { // BaseURL will be prepended to all request URL unless URL is absolute. BaseURL string // Timeout is request timeout in milliseconds. Timeout int // Headers are custom headers to be sent, and they'll be overwritten if the // same key is presented in the request. Headers map[string][]string }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.