client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package client sends httpfile.Request values over HTTP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTP *http.Client
	// contains filtered or unexported fields
}

Client sends httpfile.Request values over HTTP.

func New

func New() *Client

New returns a Client with a default timeout.

func (*Client) Send

func (c *Client) Send(ctx context.Context, req httpfile.Request) Result

Send performs req and returns its outcome. If req.Proxy is set, the request is sent through that proxy instead of connecting directly.

type Result

type Result struct {
	Request    httpfile.Request
	StatusCode int
	Status     string
	Headers    http.Header
	Body       []byte
	Duration   time.Duration
	Err        error
	// FinalURL is the URL the response actually came from, after following
	// any redirects. It equals Request.URL when there were none.
	FinalURL string
	// TLS is the connection's TLS state, or nil for a plain HTTP request.
	TLS *tls.ConnectionState
}

Result is the outcome of sending a single request. A non-nil Err means the request couldn't be sent or the response couldn't be read -- it does not mean the server returned a non-2xx status, which is a normal Result with Err == nil.

Jump to

Keyboard shortcuts

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