Skip to contents

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] "2022-11-08 14:08:48"
#> 
#> $`content-type`
#> [1] "application/json"
#> 
#> $`content-length`
#> [1] "307"
#> 
#> $etag
#> [1] "\"44967263\""
#> 
cat(rawToChar(resp$content))
#> {
#>   "args": {},
#>   "headers": {
#>     "Host": "127.0.0.1:36477",
#>     "User-Agent": "R/4.2.2 R (4.2.2 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions",
#>     "Accept": "*/*",
#>     "Accept-Encoding": "deflate, gzip, br"
#>   },
#>   "origin": "127.0.0.1",
#>   "path": "/get",
#>   "url": "http://127.0.0.1:36477/get"
#> }
proc$stop()