response_rewrite_v2

package
v0.14.5 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MatchTypeEqual   = "equal"
	MatchTypeContain = "contain"
	MatchTypePrefix  = "prefix"
	MatchTypeSuffix  = "suffix"
	MatchTypeRegex   = "regex"
)
View Source
const (
	Name = "response_rewrite_v2"
)

Variables

This section is empty.

Functions

func Create

func Create(id, name string, conf *Config, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)

func NewFactory

func NewFactory() eosc.IExtenderDriverFactory

func Register

func Register(register eosc.IExtenderDriverRegister)

Types

type Config

type Config struct {
	Matches []*Match `json:"matches" label:"响应匹配规则"`
}

type HeaderMatchRule

type HeaderMatchRule struct {
	MatchRule
	HeaderKey string `json:"header_key" label:"响应头Key"`
}

type Match

type Match struct {
	StatusCode      int                `json:"match_status_code" label:"匹配状态码" minimum:"100" default:"200" description:"最小值:100"`
	HeaderMatch     []*HeaderMatchRule `json:"match_headers" label:"响应头匹配规则"`
	BodyMatch       *MatchRule         `json:"match_body" label:"响应体匹配规则"`
	ResponseRewrite *ResponseRewrite   `json:"response_rewrite" label:"重写响应内容"`
}

type MatchRule

type MatchRule struct {
	Content   string `json:"content" label:"匹配内容"`
	MatchType string `json:"match_type" label:"匹配类型" enum:"equal,contain,prefix,suffix,regex"`
}

type ResponseRewrite

type ResponseRewrite struct {
	Body       string            `json:"body" label:"响应体"`
	StatusCode int               `json:"status_code" label:"响应状态码" default:"200"`
	Headers    map[string]string `json:"headers"`
}

ResponseRewrite 重写内容

Jump to

Keyboard shortcuts

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