library(httr2)
req <- request("http://example.com") |>
req_auth_basic("user", "password")
str(req)
#> List of 7
#> $ url : chr "http://example.com"
#> $ method : NULL
#> $ headers :List of 1
#> ..$ Authorization: chr "Basic dXNlcjpwYXNzd29yZA=="
#> ..- attr(*, "redact")= chr "Authorization"
#> $ body : NULL
#> $ fields : list()
#> $ options : list()
#> $ policies: list()
#> - attr(*, "class")= chr "httr2_request"
Created on 2025-02-12 with reprex v2.1.0
Created on 2025-02-12 with reprex v2.1.0