:wave: Thanks for your continued work on this. Love the "lazy" nature of httr2 v httr When httr2 is passed a collapsed string of query parameters it automatically escapes then which seems sensible: ``` r library(httr2) req <- request("http://example.com") # Change url components two_queries <- c("one", "two") collapsed_query <- paste0(two_queries, collapse = ",") ## automatically converts , to %2 (req <- req %>% req_url_query(q = collapsed_query)) #> <httr2_request> #> GET http://example.com?q=one%2Ctwo #> Body: empty ``` In {httr} there was, however, the option of unescaping that using `I`: ```r library(httr) r <- GET("http://example.com", query = list(q = I(collapsed_query)) ) ## can use I to use as is r$url #> [1] "http://example.com/?q=one,two" ``` This does not work in {httr2}. In {httr} this is accomplished via: https://github.com/r-lib/httr/blob/21ff69f219ad11298854a63b8f753389088cf382/R/url-query.r#L25-L28 So unless I am missing something (which is of course possible!) we are stuck with doing stuff like: ```r req <- req %>% req_url_query(q = collapsed_query) req$url <- curl::curl_unescape(req$url) req #> <httr2_request> #> GET http://example.com?q=one,two #> Body: empty ``` Would you be amenable to a PR that added an `escape`-like function somewhere, probably in httr2:::url_build`?
Activity
hadley commentedon Jun 14, 2022
Yeah, that sounds great!
Opt out of query escaping (#153)