Skip to content

Commit

Permalink
dont use ending slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicpottier committed Aug 23, 2017
1 parent c23ae2b commit d8ff1a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/courier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
_ "github.com/nyaruka/courier/handlers/africastalking"
_ "github.com/nyaruka/courier/handlers/blackmyna"
_ "github.com/nyaruka/courier/handlers/kannel"
_ "github.com/nyaruka/courier/handlers/shaqodoon"
_ "github.com/nyaruka/courier/handlers/telegram"
_ "github.com/nyaruka/courier/handlers/twilio"

Expand Down
3 changes: 2 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func NewServer(config *config.Courier, backend Backend) Server {
func NewServerWithLogger(config *config.Courier, backend Backend, logger *logrus.Logger) Server {
router := chi.NewRouter()
router.Use(middleware.DefaultCompress)
router.Use(middleware.StripSlashes)
router.Use(middleware.RequestID)
router.Use(middleware.RealIP)
router.Use(lg.RequestLogger(logger))
Expand Down Expand Up @@ -363,7 +364,7 @@ func (s *server) addRoute(handler ChannelHandler, method string, action string,
method = strings.ToLower(method)
channelType := strings.ToLower(string(handler.ChannelType()))

path := fmt.Sprintf("/%s/{uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}}/%s/", channelType, action)
path := fmt.Sprintf("/%s/{uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}}/%s", channelType, action)
s.chanRouter.Method(method, path, handlerFunc)
s.routes = append(s.routes, fmt.Sprintf("%-20s - %s %s", "/c"+path, handler.ChannelName(), action))
return nil
Expand Down

0 comments on commit d8ff1a3

Please sign in to comment.