docs

package
v4.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientFieldSpec

func ClientFieldSpec(forOutput bool, extraChildren ...docs.FieldSpec) docs.FieldSpec

ClientFieldSpec returns a field spec for an http client component.

func ServerCORSFieldSpec

func ServerCORSFieldSpec() docs.FieldSpec

ServerCORSFieldSpec returns a field spec for an http server CORS component.

Types

type Config

type Config struct {
	URL                 string                       `json:"url" yaml:"url"`
	Verb                string                       `json:"verb" yaml:"verb"`
	Headers             map[string]string            `json:"headers" yaml:"headers"`
	Metadata            metadata.IncludeFilterConfig `json:"metadata" yaml:"metadata"`
	CopyResponseHeaders bool                         `json:"copy_response_headers" yaml:"copy_response_headers"`
	ExtractMetadata     metadata.IncludeFilterConfig `json:"extract_headers" yaml:"extract_headers"`
	RateLimit           string                       `json:"rate_limit" yaml:"rate_limit"`
	Timeout             string                       `json:"timeout" yaml:"timeout"`
	Retry               string                       `json:"retry_period" yaml:"retry_period"`
	MaxBackoff          string                       `json:"max_retry_backoff" yaml:"max_retry_backoff"`
	NumRetries          int                          `json:"retries" yaml:"retries"`
	BackoffOn           []int                        `json:"backoff_on" yaml:"backoff_on"`
	DropOn              []int                        `json:"drop_on" yaml:"drop_on"`
	SuccessfulOn        []int                        `json:"successful_on" yaml:"successful_on"`
	TLS                 tls.Config                   `json:"tls" yaml:"tls"`
	ProxyURL            string                       `json:"proxy_url" yaml:"proxy_url"`
	auth.Config         `json:",inline" yaml:",inline"`
	OAuth2              auth.OAuth2Config `json:"oauth2" yaml:"oauth2"`
}

Config is a configuration struct for an HTTP client.

func NewConfig

func NewConfig() Config

NewConfig creates a new Config with default values.

type ServerCORS

type ServerCORS struct {
	Enabled        bool     `json:"enabled" yaml:"enabled"`
	AllowedOrigins []string `json:"allowed_origins" yaml:"allowed_origins"`
}

ServerCORS contains configuration for allowing CORS headers.

func NewServerCORS

func NewServerCORS() ServerCORS

NewServerCORS returns a new server CORS config with default fields.

func (ServerCORS) WrapHandler

func (conf ServerCORS) WrapHandler(handler http.Handler) (http.Handler, error)

WrapHandler wraps a provided HTTP handler with middleware that enables CORS requests (when configured).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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