httpc

package
v0.0.0-...-de4b99c Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.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 {
	http.Client
	// contains filtered or unexported fields
}

func NewHTTPClient

func NewHTTPClient(lc fx.Lifecycle, config *config.Config) *Client

func (*Client) Clone

func (c *Client) Clone() *Client

Clone is a temporary solution to the unexpected shared pointer field and race problem TODO: use latest `/util/client` for better api experience.

func (*Client) CloneAndAddRequestHeader

func (c *Client) CloneAndAddRequestHeader(key, value string) *Client

func (*Client) Send

func (c *Client) Send(
	ctx context.Context,
	uri string,
	method string,
	body io.Reader,
	errType *errorx.Type,
	errOriginComponent string,
) (*Response, error)

func (*Client) SendRequest

func (c *Client) SendRequest(
	ctx context.Context,
	uri string,
	method string,
	body io.Reader,
	errType *errorx.Type,
	errOriginComponent string,
) ([]byte, error)

TODO: Replace using go-resty.

func (Client) WithTimeout

func (c Client) WithTimeout(timeout time.Duration) *Client

type Response

type Response struct {
	*http.Response
}

func (*Response) Body

func (r *Response) Body() ([]byte, error)

Jump to

Keyboard shortcuts

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