headers

package
v0.0.0-...-6ad7431 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootPluginName = "http"
	PluginName     = "headers"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSConfig

type CORSConfig struct {
	// AllowedOrigin: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
	AllowedOrigin string `mapstructure:"allowed_origin"`

	// AllowedHeaders: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
	AllowedHeaders string `mapstructure:"allowed_headers"`

	// AllowedMethods: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
	AllowedMethods string `mapstructure:"allowed_methods"`

	// AllowCredentials https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
	AllowCredentials *bool `mapstructure:"allow_credentials"`

	// ExposeHeaders:  https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
	ExposedHeaders string `mapstructure:"exposed_headers"`

	// MaxAge of CORS headers in seconds/
	MaxAge int `mapstructure:"max_age"`
}

type Config

type Config struct {
	// CORS settings.
	CORS *CORSConfig `mapstructure:"cors"`

	// Request headers to add to every request.
	Request map[string]string `mapstructure:"request"`

	// Response headers to add to every response.
	Response map[string]string `mapstructure:"response"`
}

Config declares headers service configuration.

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func (*Plugin) Handle

func (p *Plugin) Handle(next http.Handler) http.Handler

func (*Plugin) Init

func (p *Plugin) Init(cfg config.Configurer) error

func (*Plugin) Name

func (p *Plugin) Name() string

Name returns user-friendly plugin name

Jump to

Keyboard shortcuts

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