slash

package
v0.0.0-...-be655d7 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2016 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package slash provides a trailing slash remover handler for the ozzo routing package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Remover

func Remover(status int) routing.Handler

Remover returns a handler that removes the trailing slash (if any) from the requested URL. The handler will redirect the browser to the new URL without the trailing slash. The status parameter should be either http.StatusMovedPermanently (301) or http.StatusFound (302). If the original URL has no trailing slash, the handler will do nothing. For example,

import (
    "net/http"
    "github.com/go-ozzo/ozzo-routing"
    "github.com/go-ozzo/ozzo-routing/slash"
)

r := routing.New()
r.Use(slash.Remover(http.StatusMovedPermanently))

Types

This section is empty.

Jump to

Keyboard shortcuts

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