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

print.httr2_request doesn't escape curly bois in request headers #586

Open
alexanderthedataman opened this issue Nov 20, 2024 · 0 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@alexanderthedataman
Copy link

Writing a script that converts my browser's network requests to <httr2_request> objects.

Since print.httr2_request doesn't cli:::cli_escape headers, I get an error when I try to print a network request with curly bois in its headers.

library(httr2)
#> Warning: package 'httr2' was built under R version 4.3.3

my_request <- "http://example-site.com" |>
  request() |>
  req_headers(`oddly-formatted-header` = "{\"some-website\":\"puts-jsoney-stuff-here\"}")

my_request
#> <httr2_request>
#> GET http://example-site.com
#> Headers:
#> Warning in eval(expr, envir = envir): NAs introduced by coercion
#> Warning in eval(expr, envir = envir): NAs introduced by coercion
#> Error in "cli::cli_li(paste0(\"{.field \", names(x), \"}: \", vals))": ! Could not evaluate cli `{}` expression: `"some-website":"put…`.
#> Caused by error in `"some-website":"puts-jsoney-stuff-here"`:
#> ! NA/NaN argument
@hadley hadley added the bug an unexpected problem or unintended behavior label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants