Kong / Kong/httpsnippet

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

Offen
#379 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
1.2k
Forks
242
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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"
)
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.