Help us shape the future of Go! Take the 2026 Go Developer Survey

redirect

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2015 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package redirect is middleware for redirecting certain requests to other locations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New instantiates a new Redirect middleware.

Types

type Redirect

type Redirect struct {
	Next  middleware.Handler
	Rules []Rule
}

Redirect is middleware to respond with HTTP redirects

func (Redirect) ServeHTTP

func (rd Redirect) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)

ServeHTTP implements the middleware.Handler interface.

type Rule

type Rule struct {
	From, To string
	Code     int
}

Rule describes an HTTP redirect rule.

Jump to

Keyboard shortcuts

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