Skip to content

Commit 1efadd1

Browse files
authored
Expose get_fdset() (#784)
By extracting the fdset from the connection Fixes #767
1 parent 9baf978 commit 1efadd1

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

R/req-perform-connection.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ StreamingBody <- R6::R6Class(
219219
!isIncomplete(private$conn)
220220
},
221221

222+
#' @description Get the active file descriptions and timeout from the
223+
#' handle. Wrapper around [curl::multi_fdset()].
224+
get_fdset = function() {
225+
curl::multi_fdset(private$conn)
226+
},
227+
222228
#' @description Close the connection
223229
close = function() {
224230
if (self$is_open()) {

man/StreamingBody.Rd

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,13 @@ test_that("validates its input", {
100100
StreamingBody$new(1)
101101
})
102102
})
103+
104+
test_that("can access fdset", {
105+
skip_on_cran()
106+
107+
con <- curl::curl(example_url('/drip'), open = 'rb')
108+
on.exit(close(con))
109+
110+
body <- StreamingBody$new(con)
111+
expect_length(body$get_fdset()$reads, 1)
112+
})

0 commit comments

Comments
 (0)