Skip to content

Commit ff38ef3

Browse files
committed
Upgrade to curl 6.2.1
* Remove `Host` limitation in `req_dry_run()`. Fixes #694 * Use curl error class. Fixes #693. * Replace snapshot test with something more precise
1 parent 528846a commit ff38ef3

File tree

6 files changed

+12
-27
lines changed

6 files changed

+12
-27
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Depends:
1717
R (>= 4.0)
1818
Imports:
1919
cli (>= 3.0.0),
20-
curl (>= 6.2.0),
20+
curl (>= 6.2.1),
2121
glue,
2222
lifecycle,
2323
magrittr,

R/pooled-request.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ PooledRequest <- R6Class(
118118
private$handle <- NULL
119119
req_completed(private$req_prep)
120120

121-
curl_error <- error_cnd(message = msg, class = "curl_error", call = NULL)
121+
error_class <- setdiff(class(msg), "character")
122+
curl_error <- error_cnd(message = msg, class = error_class, call = NULL)
122123
error <- curl_cnd(curl_error, call = private$error_call)
123124
error$request <- self$req
124125
private$on_error(error)

R/req-dry-run.R

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#'
88
#' ## Limitations
99
#'
10-
#' * The `Host` header is not respected.
1110
#' * The HTTP version is always `HTTP/1.1` (since you can't determine what it
1211
#' will actually be without connecting to the real server).
1312
#'

man/req_dry_run.Rd

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/_snaps/req-perform-parallel.md

-15
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,6 @@
66
Error in `req_perform_parallel()`:
77
! If supplied, `paths` must be the same length as `req`.
88

9-
# errors by default
10-
11-
Code
12-
req_perform_parallel(reqs[1])
13-
Condition
14-
Error in `req_perform_parallel()`:
15-
! HTTP 404 Not Found.
16-
Code
17-
req_perform_parallel(reqs[2])
18-
Condition
19-
Error in `req_perform_parallel()`:
20-
! Failed to perform HTTP request.
21-
Caused by error:
22-
! Could not resolve host: INVALID
23-
249
# req_perform_parallel respects http_error() body message
2510

2611
Code

tests/testthat/test-req-perform-parallel.R

+9-8
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,15 @@ test_that("immutable objects retrieved from cache", {
8888
})
8989

9090
test_that("errors by default", {
91-
reqs <- list2(
92-
request_test("/status/:status", status = 404),
93-
request("INVALID")
94-
)
95-
expect_snapshot(error = TRUE, {
96-
req_perform_parallel(reqs[1])
97-
req_perform_parallel(reqs[2])
98-
})
91+
req <- request_test("/status/:status", status = 404)
92+
cnd <- expect_error(req_perform_parallel(list(req)))
93+
expect_s3_class(cnd, "httr2_http_404")
94+
95+
# Wraps and forwards curl errors
96+
req <- request("INVALID")
97+
cnd <- expect_error(req_perform_parallel(list(req)))
98+
expect_s3_class(err, "httr2_failure")
99+
expect_s3_class(err$parent, "curl_error_unsupported_protocol")
99100
})
100101

101102
test_that("both curl and HTTP errors become errors on continue", {

0 commit comments

Comments
 (0)