dakrone / clj-http

An idiomatic clojure http client wrapping the apache client. Officially supported version.
http://clojars.org/clj-http
MIT License
1.77k stars 408 forks source link

Nested query params #623

Open jmurp opened 1 year ago

jmurp commented 1 year ago

deps

{:deps {
        org.clojure/clojure {:mvn/version "1.11.1"}
        clj-http/clj-http   {:mvn/version "3.12.3"}
        cheshire/cheshire   {:mvn/version "5.11.0"}}}

code

(require '[clj-http.client :as client])

(client/post "http://localhost:3000" {:debug true :as :json :query-params {:items [{:key1 "value"}]}})

The resulting query string (decoded) is items={:key1+"value"} I am looking for items[0][key1]=value

Is this expected?

result

{:user-info nil,
 :use-header-maps-in-response? true,
 :body-type nil,
 :as :json,
 :debug true,
 :headers {"accept-encoding" "gzip, deflate"},
 :server-port 3000,
 :url "http://localhost:3000",
 :flatten-nested-keys (:query-params),
 :uri "",
 :server-name "localhost",
 :query-string "items=%7B%3Akey1+%22value%22%7D",
 :body nil,
 :scheme :http,
 :request-method :post}
HttpRequest:
{:config nil,
 :method "POST",
 :requestLine
 #object[org.apache.http.message.BasicRequestLine 0x749ad37c "POST http://localhost:3000?items=%7B%3Akey1+%22value%22%7D HTTP/1.1"],
 :aborted false,
 :params
 #object[org.apache.http.params.BasicHttpParams 0xce19c86 "[parameters={}]"],
 :protocolVersion
 #object[org.apache.http.HttpVersion 0x4fd3b20a "HTTP/1.1"],
 :URI
 #object[java.net.URI 0x158e6fc2 "http://localhost:3000?items=%7B%3Akey1+%22value%22%7D"],
 :class org.apache.http.client.methods.HttpPost,
 :allHeaders
 [#object[org.apache.http.message.BasicHeader 0x4213bc3e "Connection: close"],
  #object[org.apache.http.message.BasicHeader 0x97beeaf "accept-encoding: gzip, deflate"]],
 :entity nil}