url_rewrite

package
v0.0.0-...-206c9bf Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

README

url_rewrite

网关转发客户端的请求到服务端点服务时,重写请求的URL路径

目前支持以下重写规则:

  • prefix 前缀重写
  • suffix 后缀重写
  • replace 替换重写

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathRewrite

type PathRewrite struct {
	Complete map[string]string `json:"complete,omitempty"`
	Prefix   map[string]string `json:"prefix,omitempty"`
	Replace  map[string]string `json:"replace,omitempty"`
	Suffix   map[string]string `json:"suffix,omitempty"`
}

path rewrite

func New

func New(config string) (*PathRewrite, error)

新建中间件实例

func (*PathRewrite) Action

func (self *PathRewrite) Action(_ http.ResponseWriter, req *http.Request) (bool, error)

中间件行为

func (*PathRewrite) GetName

func (self *PathRewrite) GetName() string

func (PathRewrite) MarshalEasyJSON

func (v PathRewrite) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PathRewrite) MarshalJSON

func (v PathRewrite) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PathRewrite) UnmarshalEasyJSON

func (v *PathRewrite) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PathRewrite) UnmarshalJSON

func (v *PathRewrite) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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