Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Encoding of query params doesn't work when marked optional #25

Open
maorelias opened this issue Oct 18, 2021 · 0 comments
Open

Encoding of query params doesn't work when marked optional #25

maorelias opened this issue Oct 18, 2021 · 0 comments

Comments

@maorelias
Copy link

maorelias commented Oct 18, 2021

When marked as optional:

(def compiled
  (contextual.http/compile-request '{:query-params {:timestamp ^:optional timestamp}, :method "get"} 
  {'timestamp (contextual.core/path :ts)} 
  {} 
  {:serialize-query-params true}))

(contextual.core/invoke compiled {:ts "2021-05-28 16:22:55.000+00   00"})
=> {:method "get", :url "?timestamp=2021-05-28 16:22:55.000+00   00"}

When not marked as optional:

(def compiled
  (contextual.http/compile-request '{:query-params {:timestamp timestamp}, :method "get"} 
  {'timestamp (contextual.core/path :ts)} 
  {} 
  {:serialize-query-params true}))

(contextual.core/invoke compiled {:ts "2021-05-28 16:22:55.000+00   00"})
=> {:method "get", :url "?timestamp=2021-05-28%2016%3A22%3A55.000%2B00%20%20%2000"}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant