shooter

package module
v0.0.0-...-31585ca Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Replacement

type Replacement struct {
	// A substring to search for. Mutually exclusive with search_regexp.
	Search string `json:"search,omitempty"`

	// A regular expression to search for. Mutually exclusive with search.
	SearchRegexp string `json:"search_regexp,omitempty"`

	// The replacement string/value. Required.
	Replace string `json:"replace"`
	// contains filtered or unexported fields
}

Replacement is either a substring or regular expression replacement to perform; precisely one must be specified, not both.

type Shooter

type Shooter struct {
	// The list of replacements to make on the response body.
	Replacements []*Replacement `json:"replacements,omitempty"`
	// If true, perform replacements in a streaming fashion.
	// This is more memory-efficient but can remove the
	// Content-Length header since knowing the correct length
	// is impossible without buffering, and getting it wrong
	// can break HTTP/2 streams.
	Stream bool `json:"stream,omitempty"`
	// contains filtered or unexported fields
}

func (Shooter) CaddyModule

func (Shooter) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*Shooter) Provision

func (h *Shooter) Provision(ctx caddy.Context) error

Provision implements caddy.Provisioner.

func (*Shooter) ServeHTTP

func (h *Shooter) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

ServeHTTP implements caddyhttp.MiddlewareHandler.

func (*Shooter) UnmarshalCaddyfile

func (h *Shooter) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler. Syntax:

replace [stream | [re] <search> <replace>] {
     stream
     [re] <search> <replace>
}

If 're' is specified, the search string will be treated as a regular expression. If 'stream' is specified, the replacement will happen without buffering the whole response body; this might remove the Content-Length header.

Jump to

Keyboard shortcuts

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