Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultTrailingSlashConfig is the default TrailingSlash middleware config. DefaultTrailingSlashConfig = TrailingSlashConfig{ Skipper: skipper.DefaultSkipper, } )
Functions ¶
func AddTrailingSlash ¶
AddTrailingSlash returns a root level (before router) middleware which adds a trailing slash to the request `URL#Path`.
Usage `makross#Pre(AddTrailingSlash())`
func AddTrailingSlashWithConfig ¶
func AddTrailingSlashWithConfig(config TrailingSlashConfig) makross.Handler
AddTrailingSlashWithConfig returns a AddTrailingSlash middleware with config. See `AddTrailingSlash()`.
func RemoveTrailingSlash ¶
RemoveTrailingSlash returns a root level (before router) middleware which removes a trailing slash from the request URI.
Usage `makross#Pre(RemoveTrailingSlash())`
func RemoveTrailingSlashWithConfig ¶
func RemoveTrailingSlashWithConfig(config TrailingSlashConfig) makross.Handler
RemoveTrailingSlashWithConfig returns a RemoveTrailingSlash middleware with config. See `RemoveTrailingSlash()`.
Types ¶
type TrailingSlashConfig ¶
type TrailingSlashConfig struct { // Skipper defines a function to skip middleware. Skipper skipper.Skipper // Status code to be used when redirecting the request. // Optional, but when provided the request is redirected using this code. RedirectCode int `json:"redirect_code"` }
TrailingSlashConfig defines the config for TrailingSlash middleware.
Click to show internal directories.
Click to hide internal directories.