call: HTTP response

The HTTP response is returned by the call function and is typically defined as follows:

  • A status code, 200 being the OK HTTP status.
  • Some headers indicating the content nature.
  • The body, which is what will be displayed upon client request.
http_response <- function(req) {
  list(
    status = 200L,
    headers = list(
      'Content-Type' = 'text/html'
    ),
    body = "Hello world!"
  )
}