1. Justin Sheehy
  2. webmachine


jus...@basho.com  committed 20cf17a

add wrq

  • Participants
  • Parent commits 4d9e4b7
  • Branches default

Comments (0)

Files changed (1)

File WebmachineReqData.wiki

View file
  • Ignore whitespace
+== Webmachine Request Data ==
+This is documentation of the Webmachine Request Data API as embodied by the {{{ "wrq" }}} module.  This module is the means by which resources access and manipulate the state of the request they are handling.
+Given that all webmachine resource functions have this signature:
+f(ReqData, Context) -> {Result, ReqData, Context}
+we should explain in detail the {{{ ReqData }}} input and output parameter.  This is a data structure used to represent the request sent by the client as well as the response being built by the resource.  The {{{ wrq }}} module is used to access the values in the input parameter.  Most functions in most resources have no need to modify the output {{{ ReqData }}} and can simply pass along the one received as input.  However, in some cases a resource will need to make some update to the response other than that implied by {{{ Result }}} and in those cases it should use the {{{ wrq }}} module to build a modified {{{ ReqData }}} from the original one for the return value.
+A couple of nonstandard types are assumed here:
+| string() | a list() with all elements in the ASCII range |
+| rd() | opaque record, used as the input/output {{{ ReqData }}} |
+The accessors are: