httpx

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package httpx wraps bogdanfinn/tls-client for Chrome-like TLS fingerprints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadAll

func ReadAll(resp *http.Response) ([]byte, error)

ReadAll reads and closes the response body.

Types

type Client

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

Client is a thin wrapper around tls-client with proxy support.

func New

func New(opts Options) (*Client, error)

New builds a Chrome-profile tls-client.

func (*Client) CloseIdleConnections added in v0.6.0

func (c *Client) CloseIdleConnections()

CloseIdleConnections 关闭底层 transport 持有的空闲连接。

func (*Client) Delete

func (c *Client) Delete(urlStr string, headers map[string]string) (*http.Response, error)

Delete issues a DELETE with query params already in urlStr using context.Background().

func (*Client) DeleteWithContext added in v0.6.0

func (c *Client) DeleteWithContext(ctx context.Context, urlStr string, headers map[string]string) (*http.Response, error)

DeleteWithContext issues a context-aware DELETE.

func (*Client) Do

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

Do executes a request. The request context controls cancellation through the underlying transport (dial, header read and body read all observe ctx.Done()).

func (*Client) Get

func (c *Client) Get(urlStr string, headers map[string]string) (*http.Response, error)

Get is a convenience GET using context.Background().

func (*Client) GetWithContext added in v0.6.0

func (c *Client) GetWithContext(ctx context.Context, urlStr string, headers map[string]string) (*http.Response, error)

GetWithContext issues a context-aware GET.

func (*Client) PostForm

func (c *Client) PostForm(urlStr string, form url.Values, headers map[string]string) (*http.Response, error)

PostForm posts application/x-www-form-urlencoded body using context.Background().

func (*Client) PostFormWithContext added in v0.6.0

func (c *Client) PostFormWithContext(ctx context.Context, urlStr string, form url.Values, headers map[string]string) (*http.Response, error)

PostFormWithContext issues a context-aware POST form.

type Options

type Options struct {
	Proxy   string
	Timeout time.Duration
}

Options configures a new Client.

Jump to

Keyboard shortcuts

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