headers

package
v2.3.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "headers"

PluginName contains default service name.

View Source
const RootPluginName = "http"

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"`
}

CORSConfig headers configuration.

type Config

type Config struct {
	Headers *struct {
		// CORS settings.
		CORS *CORSConfig

		// Request headers to add to every payload send to PHP.
		Request map[string]string

		// Response headers to add to every payload generated by PHP.
		Response map[string]string
	}
}

Config declares headers service configuration.

type Plugin

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

Plugin serves headers files. Potentially convert into middleware?

func (*Plugin) Available added in v2.2.0

func (s *Plugin) Available()

Available interface implementation

func (*Plugin) Init

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

Init must return configure service and return true if service hasStatus enabled. Must return error in case of misconfiguration. Services must not be used without proper configuration pushed first.

func (*Plugin) Middleware

func (s *Plugin) Middleware(next http.Handler) http.Handler

Middleware is HTTP plugin middleware to serve headers

func (*Plugin) Name

func (s *Plugin) Name() string

Jump to

Keyboard shortcuts

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