httputil

package
v0.0.0-...-690b2a9 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps an HTTP client and support TLS requests.

func NewClient

func NewClient(credential *security.Credential) (*Client, error)

NewClient creates an HTTP client with the given Credential.

func NewTestClient

func NewTestClient(t http.RoundTripper) *Client

NewTestClient creates a testing HTTP client.

func (*Client) CloseIdleConnections

func (c *Client) CloseIdleConnections()

CloseIdleConnections closes any connections are now sitting idle. See http.Client.CloseIdleConnections.

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do sends an HTTP request and returns an HTTP response. See http.Client.Do.

func (*Client) DoRequest

func (c *Client) DoRequest(
	ctx context.Context, url, method string, headers http.Header, body io.Reader,
) ([]byte, error)

DoRequest sends an request and returns an HTTP response content.

func (*Client) Get

func (c *Client) Get(ctx context.Context, url string) (resp *http.Response, err error)

Get issues a GET to the specified URL with context. See http.Client.Get.

func (*Client) PostForm

func (c *Client) PostForm(
	ctx context.Context, url string, data url.Values,
) (resp *http.Response, err error)

PostForm issues a POST to the specified URL, with data's keys and values URL-encoded as the request body. See http.Client.PostForm.

func (*Client) SetTimeout

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

SetTimeout specifies a time limit for requests made by this Client. See http.Client.Timeout.

func (*Client) Timeout

func (c *Client) Timeout() time.Duration

Timeout returns the timeout of the client.

Jump to

Keyboard shortcuts

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