Skip to content

Commit 44ec779

Browse files
authored
Bump requirement to R 4.1 (#745)
And use base pipe and lambda.
1 parent d888cd2 commit 44ec779

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+272
-301
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ License: MIT + file LICENSE
1414
URL: https://httr2.r-lib.org, https://github.com/r-lib/httr2
1515
BugReports: https://github.com/r-lib/httr2/issues
1616
Depends:
17-
R (>= 4.0)
17+
R (>= 4.1)
1818
Imports:
1919
cli (>= 3.0.0),
2020
curl (>= 6.2.1),

R/curl.R

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ curl_translate <- function(cmd, simplify_headers = TRUE) {
9898
main_args = perform_args,
9999
keep_if_empty = TRUE
100100
)
101-
out <- paste0(steps, collapse = paste0(pipe(), "\n "))
101+
out <- paste0(steps, collapse = paste0(" |>\n "))
102102

103103
if (clip) {
104104
cli::cli_alert_success("Copying to clipboard:")
@@ -109,10 +109,6 @@ curl_translate <- function(cmd, simplify_headers = TRUE) {
109109
structure(out, class = "httr2_cmd")
110110
}
111111

112-
pipe <- function() {
113-
if (getRversion() >= "4.1.0") " |> " else " %>% "
114-
}
115-
116112
#' @export
117113
print.httr2_cmd <- function(x, ...) {
118114
cat(x)

R/iterate-helpers.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ iterate_with_offset <- function(
8383

8484
if (!isTRUE(resp_complete(resp))) {
8585
i <<- i + offset
86-
req %>% req_url_query(!!param_name := i)
86+
req |> req_url_query(!!param_name := i)
8787
}
8888
}
8989
}
@@ -100,7 +100,7 @@ iterate_with_cursor <- function(param_name, resp_param_value) {
100100
function(resp, req) {
101101
value <- resp_param_value(resp)
102102
if (!is.null(value)) {
103-
req %>% req_url_query(!!param_name := value)
103+
req |> req_url_query(!!param_name := value)
104104
}
105105
}
106106
}
@@ -114,7 +114,7 @@ iterate_with_link_url <- function(rel = "next") {
114114
function(resp, req) {
115115
url <- resp_link_url(resp, rel)
116116
if (!is.null(url)) {
117-
req %>% req_url(url)
117+
req |> req_url(url)
118118
}
119119
}
120120
}

R/oauth-flow-auth-code.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ oauth_flow_auth_code_fetch <- function(state) {
492492
max_seconds = 60,
493493
# The endpoint may temporarily return a 404 when no code is found for a
494494
# given state because the user hasn't finished clicking through yet.
495-
is_transient = ~ resp_status(.x) %in% c(404, 429, 503)
495+
is_transient = \(resp) resp_status(resp) %in% c(404, 429, 503)
496496
)
497497
resp <- req_perform(req)
498498
body <- resp_body_json(resp)

R/oauth-flow.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
oauth_flow_fetch <- function(req, source, error_call = caller_env()) {
2-
req <- req_error(req, is_error = ~FALSE)
2+
req <- req_error(req, is_error = \(resp) FALSE)
33
resp <- req_perform(req, error_call = current_call())
44

55
oauth_flow_parse(resp, source, error_call = error_call)

R/resp-headers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ resp_link_url <- function(resp, rel) {
182182
link_headers <- headers[tolower(names(headers)) == "link"]
183183

184184
links <- unlist(lapply(link_headers, parse_link), recursive = FALSE)
185-
sel <- map_lgl(links, ~ .$rel == rel)
185+
sel <- map_lgl(links, \(x) x$rel == rel)
186186
if (sum(sel) != 1L) {
187187
return()
188188
}

R/resp-status.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#' `req |> req_options(followlocation = FALSE)`.
1717
#' * 4xx client and 5xx server errors are automatically turned into R errors.
1818
#' You can stop them from being turned into R errors with [req_error()],
19-
#' e.g. `req |> req_error(is_error = ~ FALSE)`.
19+
#' e.g. `req |> req_error(is_error = \(resp) FALSE)`.
2020
#'
2121
#' @return
2222
#' * `resp_status()` returns a scalar integer

cleanup

Lines changed: 0 additions & 3 deletions
This file was deleted.

configure

Lines changed: 0 additions & 16 deletions
This file was deleted.

configure.win

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)