Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed Clack.Util.Route to allow containing a hyphen in named parameters.

  • Loading branch information...
commit b10bee171920eb0ec627a4bc615b615132d1e0e7 1 parent 89e4cb0
@fukamachi authored
Showing with 3 additions and 2 deletions.
  1. +1 −1  src/util/route.lisp
  2. +2 −1  t/util/route.lisp
View
2  src/util/route.lisp
@@ -50,7 +50,7 @@
(defmethod compile-rule ((this <url-rule>))
(loop with pattern = (ppcre:regex-replace-all
- "[^\\?\\%\\\\/:\\*\\w]" (url this)
+ "[^\\?\\%\\\\/:\\*\\w-]" (url this)
#'escape-special-char
:simple-calls t)
with list = (split "(?::([\\w-]+)|(\\*))" pattern
View
3  t/util/route.lisp
@@ -3,7 +3,7 @@
:clack.util.route
:cl-test-more))
-(plan 21)
+(plan 22)
(defun %is-match (url-rule req-url &optional params comment)
(is (multiple-value-list (match url-rule req-url))
@@ -41,6 +41,7 @@
"containing a slash")
(is-match "/hello/:name" "/bye/fukamachi" '(nil)
"not match")
+(is-match "/blog/:post-id" "/blog/10" '("/blog/10" (:post-id "10")))
(diag "with multiple named parameter")
Please sign in to comment.
Something went wrong with that request. Please try again.