Skip to content

Commit ae72fbc

Browse files
authored
req_perform_connection() doc tweaks (#640)
1 parent 3657320 commit ae72fbc

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

R/req-perform-connection.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
#' @param blocking When retrieving data, should the connection block and wait
1818
#' for the desired information or immediately return what it has (possibly
1919
#' nothing)?
20+
#' @param verbosity How much information to print? This is a wrapper
21+
#' around [req_verbose()] that uses an integer to control verbosity:
22+
#'
23+
#' * `0`: no output
24+
#' * `1`: show headers
25+
#' * `2`: show headers and bodies as they're streamed
26+
#' * `3`: show headers, bodies, curl status messages, and stream buffer
27+
#' management
28+
#'
29+
#' Use [with_verbosity()] to control the verbosity of requests that
30+
#' you can't affect directly.
2031
#' @export
2132
#' @examples
2233
#' req <- request(example_url()) |>
@@ -30,6 +41,13 @@
3041
#'
3142
#' # Always close the response when you're done
3243
#' close(resp)
44+
#'
45+
#' # You can loop until complete with resp_stream_is_complete()
46+
#' resp <- req_perform_connection(req)
47+
#' while (!resp_stream_is_complete(resp)) {
48+
#' print(length(resp_stream_raw(resp, kb = 12)))
49+
#' }
50+
#' close(resp)
3351
req_perform_connection <- function(req, blocking = TRUE, verbosity = NULL) {
3452
check_request(req)
3553
check_bool(blocking)

man/req_perform_connection.Rd

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

0 commit comments

Comments
 (0)