Skip to content

Nested query params #1

@dazld

Description

@dazld

Currently, nested query params (type Object in the docs) are output directly as clojure literals to the query string, meaning that the stripe API sees a query-params argument of

{:active true
 :currency "GBP"
 :recurring {:interval "month"}}

... like this:

{
  "active": "true",
  "currency": "GBP",
  "recurring": {
    "interval": "{:interval \"month\"}"
  }
}

... which understandably returns a 400 bad request.

The build-query-params function should correctly handle nested maps, and produce values such as:

foo=1&bar[baz]=2 for an argument of:

{:foo 1
 :bar {:baz 2}}

I'm not sure how many levels of nesting the Stripe API may require.

Here's an example where it currently breaks:

(->> (prices/list-all {:query-params {:type "recurring"
                                      :currency "GBP"
                                      :recurring {:interval "year"}
                                      :active true
                                      :limit 10}}))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions