summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsko Nõmm <asko@bien.ee>2021-10-03 13:01:48 -0300
committerAsko Nõmm <asko@bien.ee>2021-10-03 13:01:48 -0300
commitd7b656e884546d1b498db2b2a476df1254f978b4 (patch)
tree666a11198021207d676d576bfc35d7f63e156ffd
parente1b8f0969a4bd5f1e1e390364a55ffc6aa141d65 (diff)
Fix issue with regex parsing
-rw-r--r--README.md4
-rw-r--r--project.clj2
-rw-r--r--src/ruuter/core.cljc5
3 files changed, 7 insertions, 4 deletions
diff --git a/README.md b/README.md
index a6d4180..d9d14dd 100644
--- a/README.md
+++ b/README.md
@@ -158,6 +158,10 @@ What the actual map can contain that you return depends again on the HTTP server
## Changelog
+### 1.2.1
+
+- Fixed an issue with regex parsing. Sorry about that.
+
### 1.2.0
- Implemented optional route parameters, so now you can do paths like `/hi/:name?` in your routes, and it would match the route even if the `:name` is not present. All you have to do is add a question mark to the parameter, and that's it.
diff --git a/project.clj b/project.clj
index 7674f4e..487dc9b 100644
--- a/project.clj
+++ b/project.clj
@@ -1,4 +1,4 @@
-(defproject org.clojars.askonomm/ruuter "1.2.0"
+(defproject org.clojars.askonomm/ruuter "1.2.1"
:description "A tiny HTTP router"
:url "https://github.com/askonomm/ruuter"
:license {:name "MIT"
diff --git a/src/ruuter/core.cljc b/src/ruuter/core.cljc
index 0da46b6..8052d36 100644
--- a/src/ruuter/core.cljc
+++ b/src/ruuter/core.cljc
@@ -24,8 +24,7 @@
:else
; what comes around, goes around
%))
- (string/join "\\/")
- (re-pattern))))
+ (string/join "\\/"))))
(defn- path+uri->path-params
@@ -62,7 +61,7 @@
(let [route (->> routes
(filter #(not (= :not-found (:path %))))
(map #(merge % {:regex-path (path->regex-path (:path %))}))
- (filter #(and (re-matches (:regex-path %) uri)
+ (filter #(and (re-matches (re-pattern (:regex-path %)) uri)
(= (:method %) request-method)))
first)]
(when route