Skip to content

Non-string headers are no longer converted to strings #707

Closed

Description

@vibalre
# In RStudio
# install.packages("remotes")
remotes::install_version("httr2", version = "1.1.0")
.rs.restartR()

# Works
httr2::request("https://dog.ceo/api/breed/hound/list")|>
  httr2::req_headers(Metadata = TRUE) |>
  httr2::req_perform() |>
  httr2::resp_body_json()

remotes::install_version("httr2", version = "1.1.1")
.rs.restartR()

# Fails
httr2::request("https://dog.ceo/api/breed/hound/list")|>
  httr2::req_headers(Metadata = TRUE) |>
  httr2::req_perform() |>
  httr2::resp_body_json()
# Error in curl::handle_setheaders(handle, .list = headers_flatten(req$headers)) : 
#   All headers must be strings.

# Works
httr2::request("https://dog.ceo/api/breed/hound/list")|>
  httr2::req_headers(Metadata = "true") |>
  httr2::req_perform() |>
  httr2::resp_body_json()

Change seems to be tied with the new implementation of headers_flatten. In httr2@1.1.0, it was converting header elements to character.

Activity

  1. added
    bugan unexpected problem or unintended behavior
    on Mar 24, 2025
  2. added this to the v1.1.2 milestone on Mar 24, 2025
  3. added a commit that references this issue on Mar 24, 2025
    94bc7f1
  4. hadley commented on Mar 24, 2025

    @hadley
    Member

    Oops, thanks for letting me know!

  5. added a commit that references this issue on Mar 24, 2025
    32eb8c1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions