ropensci / crul

R6 based http client for R (for developers)
https://docs.ropensci.org/crul
Other
107 stars 17 forks source link

`parse()` improve behavior when using disk (prob. stream too) #104

Closed sckott closed 5 years ago

sckott commented 5 years ago

disk: parse() throws a warning

f <- tempfile(fileext = ".json")
out <- crul::HttpClient$new("https://httpbin.org/get")$get(disk = f)
out$parse()
#> No encoding supplied: defaulting to UTF-8.
#> character(0)
#> Warning message:
#> In readBin(self$content, character()) :
#>   incomplete string at end of file has been discarded

stream: parse() throws an error

f <- function(x) print(x)
out <- crul::HttpClient$new("https://httpbin.org/get")$get(stream = f)
out$content
#> NULL
out$parse()
#> Error in readBin(self$content, character()) : invalid connection