Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

req_body_form() silently drops duplicate names #107

Closed
jchrom opened this issue Feb 21, 2022 · 0 comments · Fixed by #130
Closed

req_body_form() silently drops duplicate names #107

jchrom opened this issue Feb 21, 2022 · 0 comments · Fixed by #130
Labels
body 🕺 bug an unexpected problem or unintended behavior

Comments

@jchrom
Copy link
Contributor

jchrom commented Feb 21, 2022

In order to POST a form on a website where all the checkboxes have identical names, I need to pass a list with duplicate names. But, the duplicates are silently dropped.

The culprit seems to be .x[names(dots)] <- dots in modify_list().

It could be replaced with something like

.x[names(.x) %in% names(dots)] <- NULL
.x <- c(.x, dots)

which would have the advantage of replacing entire homonym groups, and would pass the current tests for modify_list().

It wouldn't help with the headaches in #95 and # 88 though (I am not sure about the # 88).

For a more systematic solution, how about an additional argument replace = TRUE, or a dedicated req_body_form_modify() so that we can decide whether the body gets replaced instead of combined?

  • req_body_*: replaces entire body, avoiding the modify_list() call
  • req_body_*_modify: combines lists
jchrom added a commit to jchrom/httr2 that referenced this issue Apr 22, 2022
@hadley hadley added bug an unexpected problem or unintended behavior body 🕺 labels Apr 26, 2022
hadley added a commit that referenced this issue Apr 26, 2022
Fixes #95. Fixes #97. Fixes #107.
hadley added a commit that referenced this issue Apr 28, 2022
Now uses strategy suggested by @jchrom, where we operate on "homonym groups". This makes it possible to use duplicate names in url parameters and form/multipart bodies.

Fixes #97. Fixes #107.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
body 🕺 bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants