agenthttp

package
v3.87.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package agenthttp creates standard Go [net/http.Client]s with common config options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(l logger.Logger, client *http.Client, req *http.Request, opts ...DoOption) (*http.Response, error)

Do wraps the http.Client's Do method with debug logging and tracing options.

func NewClient

func NewClient(opts ...ClientOption) *http.Client

NewClient creates a HTTP client. Note that the default timeout is 60 seconds; for some use cases (e.g. artifact operations) use WithNoTimeout.

func WithNoTimeout added in v3.83.1

func WithNoTimeout(c *clientConfig)

Types

type ClientOption

type ClientOption = func(*clientConfig)

func WithAllowHTTP2

func WithAllowHTTP2(a bool) ClientOption

func WithAuthBearer

func WithAuthBearer(b string) ClientOption

Various NewClient options.

func WithAuthToken

func WithAuthToken(t string) ClientOption

func WithTLSConfig

func WithTLSConfig(t *tls.Config) ClientOption

func WithTimeout

func WithTimeout(d time.Duration) ClientOption

type DoOption

type DoOption = func(*doConfig)

func WithDebugHTTP

func WithDebugHTTP(d bool) DoOption

func WithTraceHTTP

func WithTraceHTTP(t bool) DoOption

Jump to

Keyboard shortcuts

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