pathadaptor

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathAdaptor

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

PathAdaptor is the path Adaptor.

func New

func New(spec *Spec) *PathAdaptor

New creates a pathAdaptor.

func (*PathAdaptor) Adapt

func (pa *PathAdaptor) Adapt(path string) string

Adapt adapts path.

type RegexpReplace

type RegexpReplace struct {
	Regexp  string `yaml:"regexp" jsonschema:"required,format=regexp"`
	Replace string `yaml:"replace"`
	// contains filtered or unexported fields
}

RegexpReplace use regexp-replace pair to rewrite path.

type Spec

type Spec struct {
	Replace       string         `yaml:"replace,omitempty" jsonschema:"omitempty"`
	AddPrefix     string         `yaml:"addPrefix,omitempty" jsonschema:"omitempty,pattern=^/"`
	TrimPrefix    string         `yaml:"trimPrefix,omitempty" jsonschema:"omitempty,pattern=^/"`
	RegexpReplace *RegexpReplace `yaml:"regexpReplace,omitempty" jsonschema:"omitempty"`
}

Spec describes rules for PathAdaptor.

Jump to

Keyboard shortcuts

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