Documentation ¶
Overview ¶
Package request request transformer plugin
Index ¶
Constants ¶
View Source
const (
// DelAllKey is a placeholder for deleting all operations
DelAllKey = "-1"
)
Variables ¶
This section is empty.
Functions ¶
func ServerFilter ¶
func ServerFilter(ctx context.Context, req interface{}, handler filter.ServerHandleFunc) (interface{}, error)
ServerFilter sets up server-side CORS validation
Types ¶
type Options ¶
type Options struct { // Rewrite host RewriteHost string `yaml:"rewrite_host" json:"rewrite_host"` // Delete operations // List of reserved headers, if configured, remove operations will not be executed. -1 indicates deleting all ReserveHeaders []string `yaml:"reserve_headers" json:"reserve_headers"` // Remove headers RemoveHeaders []string `yaml:"remove_headers" json:"remove_headers"` // List of reserved query parameters, if configured, remove operations will not be executed. -1 indicates deleting all ReserveQueryStr []string `yaml:"reserve_query_str" json:"reserve_query_str"` RemoveQueryStr []string `yaml:"remove_query_str" json:"remove_query_str"` // List of reserved body parameters, if configured, remove operations will not be executed. -1 indicates deleting all ReserveBody []string `yaml:"reserve_body" json:"reserve_body"` RemoveBody []string `yaml:"remove_body"` // Rename header configuration fields in the format key:val // Renamed headers will not be formatted RenameHeaders []string `yaml:"rename_headers" json:"rename_headers"` // Parsed key-value pairs RenameHeadersKV []*KV `yaml:"-" json:"-"` // Rename query parameters in the format key:val RenameQueryStr []string `yaml:"rename_query_str" json:"rename_query_str"` RenameQueryStrKV []*KV `yaml:"-" json:"-"` RenameQueryBodyKV []*KV `yaml:"-" json:"-"` // Rename body parameters in the format key:val RenameBody []string `yaml:"rename_body" json:"rename_body"` RenameBodyKV []*KV `yaml:"-" json:"-"` // Add headers in the format key:val AddHeaders []string `yaml:"add_headers" json:"add_headers"` AddHeadersKV []*KV `yaml:"-" json:"-"` // Add query parameters in the format key:val AddQueryStr []string `yaml:"add_query_str" json:"add_query_str"` AddQueryStrKV []*KV `yaml:"-" json:"-"` AddQueryBodyKV []*KV `yaml:"-" json:"-"` // Add body parameters in the format key:val. It will be appended to different request bodies based on // the content type. AddBody []string `yaml:"add_body" json:"add_body"` AddBodyKV []*KV `yaml:"-" json:"-"` }
Options represents the parameter options
type Plugin ¶
type Plugin struct { }
Plugin implements the request transformer plugin
func (*Plugin) CheckConfig ¶
CheckConfig validates the plugin configuration and returns the parsed configuration object. Used in the ServerFilter method for parsing.
Click to show internal directories.
Click to hide internal directories.