Module stardust.request

Ziggy Request

Functions

register_index (key, func) Register a new “field” that can be used on a request object.
new (ngx) Create a new request object.

Tables

request Request object can be access like a table.


Functions

register_index (key, func)
Register a new “field” that can be used on a request object.

Parameters:

  • key the field name
  • func function to call when the field is access. The function should take a single argument, the request

Usage:

     Example:
    stardust.request.register_raw_index("foo", function(req) return string.upper(req.header["User-Agent"]) end)
    req.foo -- will the user-agent uppercased
new (ngx)
Create a new request object. A response object a table with some helper functions. You generally only access it via the helper functions or the magic of its metatable

Parameters:

  • ngx magic nginx lua object

Returns:

    a response object

Tables

request
Request object can be access like a table.

Fields:

  • path path portion of the url
  • query query string
  • cookies raw cookie header
  • ip client remote address
  • host HTTP host header or the virtual server name
  • headers table like container of http request headers. req.headers[“User-Agent”]. Note: consider this read only. Any changes here will be ignored.
  • ctx a Lua table that can be used as scratch space. No effort is made to avoid collisions, so namespace your keys.
generated by LDoc 1.3