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_multipart fails when an argument contains the letter "D" #321

Closed
sebastian-c opened this issue Sep 28, 2023 · 1 comment · Fixed by #323
Closed

req_body_multipart fails when an argument contains the letter "D" #321

sebastian-c opened this issue Sep 28, 2023 · 1 comment · Fixed by #323

Comments

@sebastian-c
Copy link

I've been trying to build a multipart request which contains directives and data. For some reason, the letter "d" seems to cause problems. The example in the documentation seems to work, but for whatever strange reason, I can't build a request that contains that letter.

I'm using httr 0.2.3

Does work

req <- request("https://example.com") %>%
  req_body_multipart(a = "some data") 

Doesn't work

req <- request("https://example.com") %>%
  req_body_multipart(d = "some data") 
Error in `modify_list()`:
! All components of ... must be named
Run `rlang::last_trace()` to see where the error occurred.

Doesn't work

req <- request("https://example.com") %>%
  req_body_multipart(data = "some data") 
Error in `modify_list()`:
! All components of ... must be named
Run `rlang::last_trace()` to see where the error occurred.

Does work

req <- request("https://example.com") %>%
  req_body_multipart(taramasalata = "some data") 

Rlang trace:

rlang::last_trace(drop=FALSE)
<error/rlang_error>
Error in `modify_list()`:
! All components of ... must be named
---
Backtrace:
    ▆
 1. ├─request("https://example.com") %>% req_body_multipart(d = "some data")
 2. └─httr2::req_body_multipart(., d = "some data")
 3.   └─httr2:::modify_body_data(.req$body$data, ...)
 4.     └─httr2:::modify_list(data, ...)
 5.       └─rlang::abort("All components of ... must be named")
@hadley
Copy link
Member

hadley commented Sep 28, 2023

This is a partial matching problem — looks like modify_body_data() needs to use .data as the first argument.

This is basically the same problem as described in https://design.tidyverse.org/dots-prefix.html.

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 a pull request may close this issue.

2 participants