Skip to content

Using reverse routing to create URI templates results in URL encoded template parameters #519

@tobyclemson

Description

@tobyclemson

I'm trying to use reitit to create URI templates by replacing a path parameter with a URI template parameter, such as in the following:

(def router
  (reitit/router
    [["/api/orders/:id" :order]]))

(def match
  (reitit/match-by-name router :order {:id "{id}"}))

(reitit/match->path match)
=> "/api/orders/%7Bid%7D"

I expect the result to be "/api/orders/{id}" and this is what is expected by most URI template libraries. Is there any way to configure / disable the URL encoding applied to path parameters so that I can get the result I want? As far as I've seen there isn't.

If there isn't, would you accept a PR to allow disabling the built in URL encoding applied to path parameters?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions