Documentation
¶
Index ¶
- Variables
- func Body(body *io.ReadCloser) ([]byte, error)
- func NewTransport() http.RoundTripper
- type Client
- func (c *Client) Delete(ctx context.Context, uri string, opts ...RequestOption) (*Response, error)
- func (c *Client) Do(ctx context.Context, method string, uri string, opts ...RequestOption) (*Response, error)
- func (c *Client) DoWithoutConcurrent(ctx context.Context, method string, uri string, opts ...RequestOption) (_ *Response, err error)
- func (c *Client) Get(ctx context.Context, uri string, opts ...RequestOption) (*Response, error)
- func (c *Client) Head(ctx context.Context, uri string, opts ...RequestOption) (*Response, error)
- func (c *Client) Options(ctx context.Context, uri string, opts ...RequestOption) (*Response, error)
- func (c *Client) Patch(ctx context.Context, uri string, opts ...RequestOption) (*Response, error)
- func (c *Client) Post(ctx context.Context, uri string, opts ...RequestOption) (*Response, error)
- type ClientOption
- type HasTimeout
- type HttpClient
- type RequestOption
- func WithBasicAuth(username string, password string) RequestOption
- func WithBasicAuthFunc(auth func(ctx context.Context) (string, string)) RequestOption
- func WithBearerAuth(token string) RequestOption
- func WithBearerAuthFunc(token func(ctx context.Context) string) RequestOption
- func WithHeader(header string, values ...string) RequestOption
- func WithHeaderFunc(header string, values func(ctx context.Context) <-chan string) RequestOption
- func WithJsonBody(body any) RequestOption
- func WithUrlEncodedBody(body url.Values) RequestOption
- func WithXmlBody(body any) RequestOption
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWrongRequest = failure.New("request") ErrWrongDefaultRequestOption = failure.New("default request option") ErrWrongRequestOption = failure.New("request option") ErrWrongBodyRequest = failure.New("body request") ErrHttpConnection = failure.New("http connection") ErrWrongBodyResponse = failure.New("body response") )
Functions ¶
func NewTransport ¶ added in v1.15.0
func NewTransport() http.RoundTripper
A clone per neighbour, so what one adapter sets on its transport — a CA, a proxy — does not reach the others, and a test can stand in for one alone.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DoWithoutConcurrent ¶
type ClientOption ¶
func WithDefaultRequestOptions ¶
func WithDefaultRequestOptions(options ...RequestOption) ClientOption
func WithHttpClient ¶
func WithHttpClient(conn HttpClient) ClientOption
func WithThreads ¶
func WithThreads(threads uint) ClientOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
func WithTransport ¶ added in v1.15.0
func WithTransport(transport http.RoundTripper) ClientOption
type HasTimeout ¶
type RequestOption ¶
func WithBasicAuth ¶
func WithBasicAuth(username string, password string) RequestOption
func WithBasicAuthFunc ¶
func WithBasicAuthFunc(auth func(ctx context.Context) (string, string)) RequestOption
func WithBearerAuth ¶
func WithBearerAuth(token string) RequestOption
func WithBearerAuthFunc ¶
func WithBearerAuthFunc(token func(ctx context.Context) string) RequestOption
func WithHeader ¶
func WithHeader(header string, values ...string) RequestOption
func WithHeaderFunc ¶
func WithHeaderFunc(header string, values func(ctx context.Context) <-chan string) RequestOption
func WithJsonBody ¶
func WithJsonBody(body any) RequestOption
func WithUrlEncodedBody ¶
func WithUrlEncodedBody(body url.Values) RequestOption
func WithXmlBody ¶
func WithXmlBody(body any) RequestOption
Click to show internal directories.
Click to hide internal directories.