sinetja/jauter

Support pattern /articles/:id.:format

ngocdaothanh opened this issue · 2 comments

"A router" should "handle dots" in {
  val router = new Router[String]
  router.pattern("/articles/:id",         "show")
  router.pattern("/articles/:id.:format", "show")

  val routed1 = router.route("/articles/123")
  routed1.target           should be ("show")
  routed1.params.size      should be (1)
  routed1.params.get("id") should be ("123")

  val routed2 = router.route("/articles/123.json")
  routed2.target               should be ("show")
  routed2.params.size          should be (2)
  routed2.params.get("id")     should be ("123")
  routed2.params.get("format") should be ("json")
}

I though this is a glitch on my side but actually perhaps there is more general pattern here.

At the moment it seems this is not possible to handle variables inside strings:

.GET("/{:segment}-inserat/:seo-part/{:adId}.html", vipHandler)

Ideally for me I am only interested in segment and adId as variables not other strings.