Create a new HTTP responseSource:
Generally, you should not need to call this function directly; you'll
get a real HTTP response by calling
req_perform() and friends. This
function is provided primarily for testing, and a place to describe
the key components of a response.
HTTP status code. Must be a single integer.
URL response came from; might not be the same as the URL in the request if there were any redirects.
HTTP method used to retrieve the response.
HTTP headers. Can be supplied as a raw or character vector which will be parsed using the standard rules, or a named list.
Response, if any, contained in the response body.
response() #> <httr2_response> #> GET https://example.com #> Status: 200 OK #> Body: Empty response(404, method = "POST") #> <httr2_response> #> POST https://example.com #> Status: 404 Not Found #> Body: Empty response(headers = c("Content-Type: text/html", "Content-Length: 300")) #> <httr2_response> #> GET https://example.com #> Status: 200 OK #> Content-Type: text/html #> Body: Empty