httpclient

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeDefault is used to select the default Go HTTP client.
	TypeDefault = "DEFAULT"
	// TypeSmart is used to select the transportd HTTP client.
	TypeSmart = "SMART"
)

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context, source settings.Source, c *Component) (http.RoundTripper, error)

Load is a convenience method for binding the source to the component.

func New

func New(ctx context.Context, source settings.Source) (http.RoundTripper, error)

New is the top-level entry point for creating a new HTTP client. The default set of plugins will be installed for the smart client. Use the LoadHTTP() method if a custom set of plugins are required.

Types

type Component

type Component struct {
	Default *DefaultComponent
	Smart   *SmartComponent
}

Component is the top level HTTP client component.

func NewComponent

func NewComponent() *Component

NewComponent populates an HTTPComponent with defaults.

func (*Component) New

func (c *Component) New(ctx context.Context, conf *Config) (http.RoundTripper, error)

New constructs a client from the given configuration.

func (*Component) Settings

func (c *Component) Settings() *Config

Settings returns the default configuration.

type Config

type Config struct {
	Type    string `description:"The type of HTTP client. Choices are SMART and DEFAULT."`
	Default *DefaultConfig
	Smart   *SmartConfig
}

Config wraps all HTTP related settings.

func (*Config) Name

func (*Config) Name() string

Name of the config.

type DefaultComponent

type DefaultComponent struct{}

DefaultComponent is a component for creating the default Go HTTP client.

func (*DefaultComponent) New

New constructs a client from the given configuration

func (*DefaultComponent) Settings

func (*DefaultComponent) Settings() *DefaultConfig

Settings returns the default configuration.

type DefaultConfig

type DefaultConfig struct {
	ContentType string
}

DefaultConfig contains all settings for the default Go HTTP client.

type RoundTripper

type RoundTripper = http.RoundTripper

RoundTripper is the interface that handles all HTTP operations. It is almost exclusively used with an http.Client wrapped around it. This is included here for documentation purposes only.

type SmartComponent

type SmartComponent struct {
	Plugins []transportd.NewComponent
}

SmartComponent is a component for creating a transportd HTTP client.

func (*SmartComponent) New

New constructs a client from the given configuration.

func (*SmartComponent) Settings

func (*SmartComponent) Settings() *SmartConfig

Settings returns the default configuration.

type SmartConfig

type SmartConfig struct {
	OpenAPI string `description:"The full OpenAPI specification with transportd extensions."`
}

SmartConfig contains all settings for the transportd HTTP client.

func (*SmartConfig) Name

func (*SmartConfig) Name() string

Name of the configuration tree.

Jump to

Keyboard shortcuts

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