Set StrictSlash on API router to automatically redirect to correct url if slash is not provided

pull/24/head
Jordan 2014-03-18 13:58:08 -05:00
parent af35130222
commit ef371f68bd
1 changed files with 1 additions and 0 deletions

View File

@ -30,6 +30,7 @@ func CreateRouter() *nosurf.CSRFHandler {
// Create the API routes // Create the API routes
api := router.PathPrefix("/api").Subrouter() api := router.PathPrefix("/api").Subrouter()
api = api.StrictSlash(true)
api.HandleFunc("/", Use(API, mid.RequireLogin)) api.HandleFunc("/", Use(API, mid.RequireLogin))
api.HandleFunc("/reset", Use(API_Reset, mid.RequireLogin)) api.HandleFunc("/reset", Use(API_Reset, mid.RequireLogin))
api.HandleFunc("/campaigns/", Use(API_Campaigns, mid.RequireAPIKey)) api.HandleFunc("/campaigns/", Use(API_Campaigns, mid.RequireAPIKey))