Skip to content

This function reconstructs the HTTP message that httr2 received from the server. It's unlikely to be exactly byte-for-byte identical (because most servers compress at least the body, and HTTP/2 can also compress the headers), but it conveys the same information.

Usage

resp_raw(resp)

Arguments

resp

An HTTP response

Value

resp (invisibly).

Examples

resp <- request("https://httpbin.org/json") %>% req_perform()
resp %>% resp_raw()
#> HTTP/1.1 200 OK
#> date: Wed, 03 Aug 2022 12:33:55 GMT
#> content-type: application/json
#> content-length: 429
#> server: gunicorn/19.9.0
#> access-control-allow-origin: *
#> access-control-allow-credentials: true
#> 
#> {
#>   "slideshow": {
#>     "author": "Yours Truly", 
#>     "date": "date of publication", 
#>     "slides": [
#>       {
#>         "title": "Wake up to WonderWidgets!", 
#>         "type": "all"
#>       }, 
#>       {
#>         "items": [
#>           "Why <em>WonderWidgets</em> are great", 
#>           "Who <em>buys</em> WonderWidgets"
#>         ], 
#>         "title": "Overview", 
#>         "type": "all"
#>       }
#>     ], 
#>     "title": "Sample Slide Show"
#>   }
#> }
#>