Learn R Programming

RestRserve (version 0.1.0.10)

create_response: creates http response

Description

facilitates in creation of proper response object. User functions should always return object created with this function.

Usage

create_response(body = "", content_type = "text/html",
  headers = character(0), status_code = 200L)

Arguments

body

must be a character vector of length one or a raw vector. If it is a named character with a name file or tmpfile then the value is considered as a path to a file and content oh this file is served as body. The latter will be deleted once served.

content_type

"text/html" must be a character vector of length one

headers

character(0) must be a character vector - the elements will have CRLF appended. Neither Content-type nor Content-length may be used.

status_code

200L must be an integer

Value

object of the class "RestRserveResponse" which is essentially a R's list.