http

package
v0.0.0-...-c5633df Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrHTTPClientDying is used to indicate to *third parties* that the
	// http client worker is dying, instead of catacomb.ErrDying, which is
	// unsuitable for propagating inter-worker.
	// This error indicates to consuming workers that their dependency has
	// become unmet and a restart by the dependency engine is imminent.
	ErrHTTPClientDying = errors.ConstError("http client worker is dying")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient interface {
	// Do sends an HTTP request and returns an HTTP response. The client will
	// follow policy (such as redirects, cookies, auth) as configured on the
	// client.
	Do(*http.Request) (*http.Response, error)
}

HTTPClient is the interface that is used to do http requests.

type HTTPClientGetter

type HTTPClientGetter interface {
	// GetHTTPClient returns a http client for the given namespace.
	GetHTTPClient(context.Context, Purpose) (HTTPClient, error)
}

HTTPClientGetter is the interface that is used to get a http client for a given namespace.

type Purpose

type Purpose string

Purpose is a type used to define the namespace of a http client. This allows multiple http clients to be created with different namespaces.

const (
	// CharmhubPurpose is the namespace for the charmhub http client.
	CharmhubPurpose Purpose = "charmhub"
	// S3Purpose is the namespace for the s3 http client.
	S3Purpose Purpose = "s3"
	// SSHImporterPurpose is the namespace for the ssh importer http client.
	SSHImporterPurpose Purpose = "ssh-importer"
)

func (Purpose) String

func (n Purpose) String() string

Jump to

Keyboard shortcuts

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