httpc

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package httpc sends requests built from core domain types and captures per-phase timings via httptrace. It has no TUI dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event added in v0.4.0

type Event struct {
	Name string
	At   time.Duration
	Took time.Duration
}

Event is one httptrace point: when it happened relative to the request start, and how long the phase it closes took (zero for instants).

type Response

type Response struct {
	Status     string
	StatusCode int
	Proto      string
	Headers    http.Header
	Body       []byte
	// Truncated is set when the body exceeded the in-memory cap.
	Truncated bool
	Timings   Timings
}

func Send

func Send(ctx context.Context, req *core.Request) (*Response, error)

Send honors context cancellation at any phase, including body download.

func (*Response) Size

func (r *Response) Size() int

type Timings

type Timings struct {
	DNS     time.Duration
	Connect time.Duration
	TLS     time.Duration
	// TTFB is measured from the start of the round trip to the first
	// response byte.
	TTFB  time.Duration
	Total time.Duration

	// Events are the trace points in order, each offset from the start of
	// the round trip, so a caller can draw a waterfall rather than a set of
	// bars that all begin at zero.
	Events []Event
}

Timings leaves phases that did not happen (e.g. reused connection, plain HTTP) at zero.

Jump to

Keyboard shortcuts

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