From ef371f68bd2e3be97eb786aee8375440eb8b53e5 Mon Sep 17 00:00:00 2001 From: Jordan Date: Tue, 18 Mar 2014 13:58:08 -0500 Subject: [PATCH] Set StrictSlash on API router to automatically redirect to correct url if slash is not provided --- controllers/route.go | 1 + 1 file changed, 1 insertion(+) diff --git a/controllers/route.go b/controllers/route.go index 12019804..9a7f7708 100644 --- a/controllers/route.go +++ b/controllers/route.go @@ -30,6 +30,7 @@ func CreateRouter() *nosurf.CSRFHandler { // Create the API routes api := router.PathPrefix("/api").Subrouter() + api = api.StrictSlash(true) api.HandleFunc("/", Use(API, mid.RequireLogin)) api.HandleFunc("/reset", Use(API_Reset, mid.RequireLogin)) api.HandleFunc("/campaigns/", Use(API_Campaigns, mid.RequireAPIKey))