rewrite

package
v0.0.0-...-c360844 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2016 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "rewrite"

Variables

This section is empty.

Functions

func Apply

func Apply(in io.Reader, out io.Writer, request *http.Request) error

Apply reads a template string from the provided reader, applies variables from the provided request object to it and writes the result into the provided writer.

Template is standard Go's http://golang.org/pkg/text/template/.

func ApplyString

func ApplyString(in string, out io.Writer, request *http.Request) error

ApplyString applies variables from the provided request object to the provided template string and writes the result into the provided writer.

Template is standard Go's http://golang.org/pkg/text/template/.

func CliFlags

func CliFlags() []cli.Flag

func FromCli

func FromCli(c *cli.Context) (plugin.Middleware, error)

func FromOther

func FromOther(rw Rewrite) (plugin.Middleware, error)

func GetSpec

func GetSpec() *plugin.MiddlewareSpec

Types

type Rewrite

type Rewrite struct {
	Regexp      string
	Replacement string
	RewriteBody bool
	Redirect    bool
}

func NewRewrite

func NewRewrite(regex, replacement string, rewriteBody, redirect bool) (*Rewrite, error)

func (*Rewrite) NewHandler

func (rw *Rewrite) NewHandler(next http.Handler) (http.Handler, error)

func (*Rewrite) String

func (rw *Rewrite) String() string

Jump to

Keyboard shortcuts

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