njs/http

Types

pub type HTTPHandler =
  fn(HTTPRequest) -> Nil
pub type HTTPRequest
pub type HTTPResponse =
  HTTPRequest

Functions

pub fn args(request r: HTTPRequest) -> Json
pub fn done(request r: HTTPRequest) -> Nil
pub fn error(
  request r: HTTPRequest,
  message m: String,
) -> HTTPRequest
pub fn finish(request r: HTTPRequest) -> Nil
pub fn get_headers_out(request r: HTTPRequest) -> Json
pub fn get_raw_headers_out(
  request r: HTTPRequest,
) -> Array(#(String, String))
pub fn get_raw_variables(request r: HTTPRequest) -> Buffer
pub fn get_variables(request r: HTTPRequest) -> Json
pub fn headers_in(request r: HTTPRequest) -> Json
pub fn internal_redirect(
  request r: HTTPRequest,
  uri u: String,
) -> Nil
pub fn is_internal(request r: HTTPRequest) -> Bool
pub fn log(
  request r: HTTPRequest,
  message m: String,
) -> HTTPRequest
pub fn method(request r: HTTPRequest) -> String
pub fn parent(request r: HTTPRequest) -> HTTPRequest
pub fn raw_headers_in(
  request r: HTTPRequest,
) -> Array(#(String, String))
pub fn remote_address(request r: HTTPRequest) -> String
pub fn request_buffer(request r: HTTPRequest) -> Buffer
pub fn request_text(request r: HTTPRequest) -> String
pub fn response_buffer(request r: HTTPRequest) -> Buffer
pub fn response_text(request r: HTTPRequest) -> String
pub fn return_buffer(
  request r: HTTPRequest,
  code c: Int,
  return b: Buffer,
) -> Nil
pub fn return_code(request r: HTTPRequest, code c: Int) -> Nil
pub fn return_text(
  request r: HTTPRequest,
  code c: Int,
  return t: String,
) -> Nil
pub fn send_buffer(
  request r: HTTPRequest,
  buffer d: Buffer,
  options o: a,
) -> HTTPRequest
pub fn send_header(request r: HTTPRequest) -> HTTPRequest
pub fn send_text(
  request r: HTTPRequest,
  data d: String,
) -> HTTPRequest
pub fn set_headers_out(
  request r: HTTPRequest,
  key k: a,
  value v: b,
) -> HTTPRequest
pub fn set_status(
  request r: HTTPRequest,
  status s: Int,
) -> HTTPRequest
pub fn set_variables(
  request r: HTTPRequest,
  key k: a,
  value v: b,
) -> HTTPRequest
pub fn status(request r: HTTPRequest) -> Int
pub fn subrequest(
  request r: HTTPRequest,
  uri u: String,
  options o: a,
) -> Promise(HTTPRequest)
pub fn uri(request r: HTTPRequest) -> String
pub fn version(request r: HTTPRequest) -> String
pub fn warn(
  request r: HTTPRequest,
  message m: String,
) -> HTTPRequest
Search Document