response-headers: HTTP Response Header Fields

Description Usage Arguments Details Value Examples

Description

Within prairie, getting and setting the fields of the response header is much like assigning values to lists. One can use [ to extract one or more fields or replace a single field.

Usage

1
2
3
4
5
## S3 method for class 'response'
x[field]

## S3 replacement method for class 'response'
x[field] <- value

Arguments

x

A response object.

field

An HTTP response header field name.

Details

For more information regarding specific HTTP response header fields refer to http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html.

Value

A list of corresponding header field values. If the response does not contain a certain field then NULL is returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# create new response
res <- response()

# add single field to header
res["Connection"] <- "keep-alive"

# add multiple fields at once
res[] <- list(
  Date = Sys.time(),
  Server = 'R/prairie'
)

res

nteetor/prairie documentation built on May 24, 2019, 9:56 a.m.