Skip to content

A web app similar to https://httpbin.org. See its specific docs. You can also see these docs locally, by starting the app:

httpbin <- new_app_process(httpbin_app())
browseURL(httpbin$url())

Usage

httpbin_app(log = interactive())

Arguments

log

Whether to log requests to the standard output.

Value

A webfakes_app.

Examples

app <- httpbin_app()
proc <- new_app_process(app)
url <- proc$url("/get")
resp <- curl::curl_fetch_memory(url)
curl::parse_headers_list(resp$headers)
#> $connection
#> [1] "close"
#> 
#> $date
#> [1] "Sat, 27 Apr 2024 07:23:38 GMT"
#> 
#> $`content-type`
#> [1] "application/json"
#> 
#> $`content-length`
#> [1] "313"
#> 
#> $etag
#> [1] "\"2fe8ddc3\""
#> 
cat(rawToChar(resp$content))
#> {
#>   "args": {},
#>   "headers": {
#>     "Host": "127.0.0.1:41325",
#>     "User-Agent": "R/4.4.0 R (4.4.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions",
#>     "Accept": "*/*",
#>     "Accept-Encoding": "deflate, gzip, br, zstd"
#>   },
#>   "origin": "127.0.0.1",
#>   "path": "/get",
#>   "url": "http://127.0.0.1:41325/get"
#> }
proc$stop()