Skip to content

Changes for modern httr2 - #558

Open
sckott wants to merge 7 commits into
mainfrom
modern-httr2
Open

Changes for modern httr2#558
sckott wants to merge 7 commits into
mainfrom
modern-httr2

Conversation

@sckott

@sckott sckott commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

fixes #532

The one thing I'm not sure about this https://github.com/ropensci/vcr/blob/main/R/serialize-headers.R#L48 We still need the function but should we change for modern httr2?

sckott added 4 commits June 26, 2026 22:17
- update minimum httr2 version
- remove modern_httr2() toggle
- replace internal list2str with httr2::url_query_build
@sckott
sckott requested a review from hadley July 18, 2026 04:25
@sckott sckott added this to the v2.2 milestone Jul 18, 2026
Comment thread R/request_handler-httr2.R Outdated
if (modern_httr2()) {
return(getNamespace("httr2")$req_get_method(req))
check_httr2_version <- function(call = rlang::caller_env()) {
if (!is_installed("httr2", version = "1.2.0")) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use check_required() here

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you meant check_installed here?

Comment thread R/request_handler-httr2.R Outdated
Comment thread tests/testthat/test-request_handler-httr2.R Outdated
@hadley

hadley commented Jul 18, 2026

Copy link
Copy Markdown
Member

Why do we still need request_headers_redact()?

@sckott

sckott commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

Why do we still need request_headers_redact()?

What i'm proposing is to change the function to (or similar):

request_headers_redact <- function(headers) {
  matches <- match("authorization", tolower(names(headers)))
  matches <- matches[!is.na(matches)]

  if (length(matches) == 0) {
    headers
  } else {
    headers[-matches]
  }
}

Because we still want to automatically remove Authorization headers across all http clients, yes?

@hadley

hadley commented Jul 20, 2026

Copy link
Copy Markdown
Member

Oh gotcha. If it's used for other backends, then you'll need to keep it.

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 this pull request may close these issues.

Bump httr2 requirement and remove old code

2 participants