Kong / Kong/httpsnippet

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

未關閉
#379 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
1.2k
分支
242
PR 合併指標
30 天內沒有已合併 PR

描述

When using the library to convert an HTTP request into an R code snippet, **parameters with special characters** (such as `codes[]` or `demo-param`) are not being quoted correctly in the generated R code. This causes an error in R because such parameters are not valid without quotes.

In R, certain special characters like `[]`, `-`, and others are not valid in unquoted object names. As a result, the generated R code fails to execute properly when using such parameters.

I also saw a test case at "https://github.com/Kong/httpsnippet/blob/master/src/targets/r/httr/fixtures/nested.r" which doesn't run in R,
it gives following error
```
Error: unexpected '=' in:
"queryString <- list(
foo[bar] ="
Execution halted
```

Instead it should be like this to run correctly and avoid any special character issues.
```
queryString <- list(
`foo[bar]` = "baz,zap",
`fiz` = "buz"
)
```

貢獻指南

開啟貢獻指南

研究方向

Start by running the R fixture at src/targets/r/httr/fixtures/nested.r and inspect the R target code that generates its queryString list. Confirm the failure with keys such as foo[bar] or demo-param; done means the generated snippet uses valid quoted names and executes successfully in R.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
r
領域
tooling
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。