Giter Site home page Giter Site logo

ruuter's Issues

Implement ability to match the entire path with `:match*`

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.

function `ruuter.core/route+req->response` overwrites ":param" keyword from ring request map

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"}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.