askonomm / ruuter Goto Github PK
View Code? Open in Web Editor NEWA system-agnostic, zero-dependency router
License: MIT License
A system-agnostic, zero-dependency router
License: MIT License
Current logic breaks the path into a sequence split by /
, which makes it impossible to match the entire path since we can't see it. So we should detect a keyword with an asterisk and if present, not split anything at all, but match straight up.
Hi o/
I was using ruuter with some ring middleware: ring.middleware.params/wrap-params
and ring.middleware.keyword-params/wrap-keyword-params
from ring/ring-core "1.10.0"
The first one parses any payload in a request body a puts it in the :params
and :form-params
keys of the request map (it also parses any query params but I was using form params)
The second one turn to keywords the keys of the :params
map.
But I was getting an empty params map in my handler.
I noticed that in L108 and L109 of ruuter.core
there's:
(response (->> {:params (path+uri->path-params path uri)}
(merge req)))
in the route+req->response
function
Since it's using thread last it's overwriting the parsed form params from the middleware
(merge
;; form params from wrap-params ring middleware
{:params {:content "hello world"}}
;; empty query params from ruuter (OK since I don't have any in that route)
{:params {}})
;; => {:params {}}
I don't know if changing it to a thread first macro breaks anything ๐ค
(merge
;; empty query params from ruuter (OK since I don't have any in that route)
{:params {}}
;; form params from wrap-params ring middleware
{:params {:content "hello world"}})
;; => {:params {:content "hello world"}}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.