Public methods
Method print()
print method for HttpResponse objects
Usage
HttpResponse$print(x, ...)
Arguments
x
self
...
ignored
Method new()
Create a new HttpResponse object
Usage
HttpResponse$new(
method,
url,
opts,
handle,
status_code,
request_headers,
response_headers,
response_headers_all,
modified,
times,
content,
request
)
Arguments
method
(character) HTTP method
url
(character) A url, required
opts
(list) curl options
handle
A handle
status_code
(integer) status code
request_headers
(list) request headers, named list
response_headers
(list) response headers, named list
response_headers_all
(list) all response headers, including
intermediate redirect headers, unnamed list of named lists
modified
(character) modified date
times
(vector) named vector
content
(raw) raw binary content response
request
request object, with all details
Method parse()
Parse the raw response content to text
Usage
HttpResponse$parse(encoding = NULL, ...)
Arguments
encoding
(character) A character string describing the
current encoding. If left as NULL
, we attempt to guess the
encoding. Passed to from
parameter in iconv
...
additional parameters passed on to iconv
(options: sub,
mark, toRaw). See ?iconv
for help
Returns
character string
Method success()
Was status code less than or equal to 201
Usage
HttpResponse$success()
Returns
boolean
Method status_http()
Get HTTP status code, message, and explanation
Usage
HttpResponse$status_http(verbose = FALSE)
Arguments
verbose
(logical) whether to get verbose http status description,
default: FALSE
Returns
object of class "http_code", a list with slots for status_code,
message, and explanation
Method raise_for_status()
Check HTTP status and stop with appropriate
HTTP error code and message if >= 300. otherwise use httpcode.
If you have fauxpas
installed we use that.
Usage
HttpResponse$raise_for_status()
Returns
stop or warn with message
Method clone()
The objects of this class are cloneable with this method.
Usage
HttpResponse$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.