httputil

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(timeout time.Duration) *http.Client

NewHTTPClient returns an *http.Client with the given timeout whose transport injects the CLI User-Agent header on every request.

func NewTransport

func NewTransport(base http.RoundTripper, opts ...TransportOption) http.RoundTripper

NewTransport returns an http.RoundTripper that injects the CLI User-Agent header (and any extra headers from opts) before delegating to base. If base is nil, http.DefaultTransport is used.

func SetVersion

func SetVersion(v string)

SetVersion records the build-time version for use in the User-Agent header.

func Version

func Version() string

Version returns the current CLI version string.

Types

type TransportOption

type TransportOption func(*cliTransport)

TransportOption configures a cliTransport.

func WithHeader

func WithHeader(key, value string) TransportOption

WithHeader adds a static header to every outgoing request. If value is empty the header is not set.

Jump to

Keyboard shortcuts

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