Skip to content

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

Closed
@sebastian-c

Description

@sebastian-c

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions