Skip to content

Commit

Permalink
[docs] Note StrictSlash re-direct behaviour #308
Browse files Browse the repository at this point in the history
* StrictSlash enabled routes return a 301 to the client
* As per the HTTP standards, non-idempotent methods, such as POST or PUT, will be followed with a GET by the client
* Users should use middleware if they wish to change this behaviour to return a HTTP 308.
  • Loading branch information
elithrar authored Dec 2, 2017
1 parent 65ec724 commit 5a3d4cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,18 @@ func (r *Router) GetRoute(name string) *Route {
// StrictSlash defines the trailing slash behavior for new routes. The initial
// value is false.
//
// When true, if the route path is "/path/", accessing "/path" will redirect
// When true, if the route path is "/path/", accessing "/path" will perform a redirect
// to the former and vice versa. In other words, your application will always
// see the path as specified in the route.
//
// When false, if the route path is "/path", accessing "/path/" will not match
// this route and vice versa.
//
// The re-direct is a HTTP 301 (Moved Permanently). Note that when this is set for
// routes with a non-idempotent method (e.g. POST, PUT), the subsequent re-directed
// request will be made as a GET by clients. Use middleware to modify this behaviour
// as needed.
//
// Special case: when a route sets a path prefix using the PathPrefix() method,
// strict slash is ignored for that route because the redirect behavior can't
// be determined from a prefix alone. However, any subrouters created from that
Expand Down

0 comments on commit 5a3d4cd

Please # to comment.