Skip to content

Conversation

abansal21
Copy link

Resolves #379

@CLAassistant
Copy link

CLAassistant commented Jul 14, 2025

CLA assistant check
All committers have signed the CLA.

@abansal21
Copy link
Author

After reviewing this I suggest that we go with removing queryString altogether and just use url,

for an example, take GET request to "https://postman-echo.com/get?codes[web]=1&codes=2&test[]=2&codes=1"

it generates

library(httr)

url <- "https://postman-echo.com/get"

queryString <- list(
  `codes[web]` = "1",
  `codes` = "2,1",
  `test[]` = "2"
)

response <- VERB("GET", url, query = queryString, content_type(""))

content(response, "text")

which gives a response

{
  "args":{
    "codes":{
      "web":"1",
      "2,1":true
    },
    "test":["2"]
  }
. . .
}

But the actual response should be

"args": {
    "codes": {
      "0": "2",
      "1": "1",
      "web": "1"
    },
    "test": [
      "2"
    ]
  }
...

you can see this just by opening the above link

So the correct code generated should be

library(httr)

url <- "https://postman-echo.com/get?codes[web]=1&codes=2&test[]=2&codes=1"

response <- VERB("GET", url, content_type(""))

content(response, "text")

I have this change and can make it in the same pr if the maintainers believe that its appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: R Code Generation Does Not Quote Parameters with Special Characters (e.g., codes[])
3 participants