dakrone / dakrone/clj-http

Nested query params

Open
#623 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
1.8k
Forks
410
PR merge metrics
No merged PRs in 30d

Description

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}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the request using the provided deps and clj-http.client/post example, then trace how the :query-params option becomes the query string. Compare the current encoding of the nested vector and map with the requested bracketed form; done means nested parameters are encoded as expected, with coverage for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.