middleware

package
v0.6.20 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Elapsed

func Elapsed(what string) func()

func EnrichPathParams

func EnrichPathParams(r *http.Request, params map[string]string)

func EnrichRequestBody

func EnrichRequestBody(r *http.Request) error

func EnrichRule

func EnrichRule(req *http.Request, r *rule.Rule)

func ExtractMiddleware

func ExtractMiddleware(r *http.Request, name string) (rule.MiddlewareSpec, bool)

func ExtractPathParams

func ExtractPathParams(r *http.Request) (map[string]string, bool)

func ExtractRequestBody

func ExtractRequestBody(r *http.Request) (io.ReadCloser, bool)

func ExtractRule

func ExtractRule(r *http.Request) (*rule.Rule, bool)

Types

type Attribute

type Attribute struct {
	Key    string        `yaml:"key" mapstructure:"key"`
	Type   AttributeType `yaml:"type" mapstructure:"type"`
	Index  string        `yaml:"index" mapstructure:"index"` // proto index
	Path   string        `yaml:"path" mapstructure:"path"`
	Params []string      `yaml:"params" mapstructure:"params"`
	Value  string        `yaml:"value" mapstructure:"value"`
}

type AttributeType

type AttributeType string
const (
	AttributeTypeQuery       AttributeType = "query"
	AttributeTypeHeader      AttributeType = "header"
	AttributeTypeJSONPayload AttributeType = "json_payload"
	AttributeTypeGRPCPayload AttributeType = "grpc_payload"
	AttributeTypePathParam   AttributeType = "path_param"
	AttributeTypeConstant    AttributeType = "constant"
)

type Middleware

type Middleware interface {
	Info() *MiddlewareInfo
	ServeHTTP(rw http.ResponseWriter, req *http.Request)
}

type MiddlewareInfo

type MiddlewareInfo struct {
	Name        string
	Description string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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