Learn R Programming

vcr (version 0.2.6)

Request: The request of an HTTPInteraction

Description

The request of an HTTPInteraction

Usage

Request

Arguments

method

the HTTP method (i.e. :head, :options, :get, :post, :put, :patch or :delete)

uri

the request URI

body

the request body

headers

the request headers

Format

An object of class R6ClassGenerator of length 24.

Details

Methods

to_hash()

Get a hash from the class itself

from_hash()

Create a Request class object from a hash

Examples

Run this code
# NOT RUN {
url <- "https://eu.httpbin.org/post"
body <- list(foo = "bar")
headers <- list(
  `User-Agent` = "libcurl/7.54.0 r-curl/3.2 crul/0.5.2",
  `Accept-Encoding` = "gzip, deflate",
  Accept = "application/json, text/xml, application/xml, */*"
)

(x <- Request$new("POST", url, body, headers))
x$body
x$method
x$uri
x$host
x$path
x$headers
h <- x$to_hash()
x$from_hash(h)
# }

Run the code above in your browser using DataLab