last_response | R Documentation |
last_request()
and last_response()
retrieve the most recent request
made by httr2 and the response it received, to facilitate debugging problems
after they occur.
last_request_json()
and last_response_json()
return the JSON bodies of
the most recent request and response. They will error if not JSON.
last_response()
last_request()
last_request_json(pretty = TRUE)
last_response_json(pretty = TRUE)
pretty |
Should the JSON be pretty-printed? |
last_request()
and last_response()
return an HTTP
request or response respectively. If no request has been made,
last_request()
will return NULL
; if no request has been made
or the last request was unsuccessful, last_response()
will return
NULL
.
last_request_json()
and last_response_json()
always return a string.
They will error if last_request()
or last_response()
are NULL
or
don't have JSON bodies.
. <- request("http://httr2.r-lib.org") |> req_perform()
last_request()
last_response()
. <- request(example_url("/post")) |>
req_body_json(list(a = 1, b = 2)) |>
req_perform()
last_request_json()
last_request_json(pretty = FALSE)
last_response_json()
last_response_json(pretty = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.