clj-http icon indicating copy to clipboard operation
clj-http copied to clipboard

allow nested array query params

Open GordianNaught opened this issue 2 years ago • 2 comments

The only issue I foresee is the handling of empty dictionary query params. I'm assuming, based on the lack of test coverage, that this isn't a real use case?

GordianNaught avatar Jan 26 '23 08:01 GordianNaught

@GordianNaught it looks like this causes a number of test failures (with lein test :all), with regard to changed multi-value query params:

lein test :only clj-http.test.client-test/multi-valued-query-params

FAIL in (multi-valued-query-params) (client_test.clj:1698)
multi-valued query params in indexed-style
a[1]=2&a[2]=3&b[0]=x&b[2]=z&a[0]=1&b[1]=y
expected: (.contains query-string "b[0]=x&b[1]=y&b[2]=z")
  actual: false

(It also changes things with empty offsets like a[]=1&a[]=2)

dakrone avatar Jan 26 '23 20:01 dakrone

I just looked at those tests. I have to make the wrap-nested-params middleware aware of the multi-param-style and the encoding. I can do that, but this gets wonky pretty quickly as I can't recur on multi-param-entries. As it is currently written, multi-param-entries will not look deeper into the nested structure. This looks like it will require a larger refactor than I was anticipating to support these other parameter styles.

GordianNaught avatar Jan 27 '23 01:01 GordianNaught