Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@simplyalexander

Description

@simplyalexander

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

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