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

未關閉
#379 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

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

研究方向

首先執行 src/targets/r/httr/fixtures/nested.r 中的 R fixture,並檢查產生其 queryString 清單的 R target code。使用 foo[bar] 或 demo-param 等鍵確認此失敗;當產生的 snippet 使用有效的帶引號名稱並在 R 中成功執行時,即表示完成。

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

描述

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"
)
主要語言
TypeScript
星號
1.2k
分支
242
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

Kong/httpsnippet 的其他 Issue

查看 Kong/httpsnippet 的全部 Issue

相似的 Issue

更多 TypeScript Issue

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

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