add HTTP status enums, rework ErrorReponse proxy to use them
[squeep-api-dingus] / lib / dingus.js
index 0a5f9d8d50badb5dc0ceb3b4a3c4d876a87cc58e..a5f77ab19fa02f1df8d8fec140ef5347c94eb5f2 100644 (file)
@@ -118,6 +118,9 @@ class Dingus {
   /**
    * Common header tagging for all requests.
    * Add our own identifier, and persist any external transit identifiers.
+   * Sets requestId on ctx to a new uuid.
+   * If X-Request-Id or X-Correlation-Id exist on incoming headers, sets them
+   * on outgoing headers and sets on ctx.
    * @param {http.ClientRequest} req 
    * @param {http.ServerResponse} res 
    * @param {object} ctx 
@@ -164,7 +167,7 @@ class Dingus {
 
 
   /**
-   * 
+   * Sets ctx.clientAddress and ctx.clientProtocol.
    * @param {http.ClientRequest} req 
    * @param {http.ServerResponse} res 
    * @param {object} ctx 
@@ -177,6 +180,7 @@ class Dingus {
 
   /**
    * Called before every request handler.
+   * Sets tracking identifiers and client information on ctx.
    * @param {http.ClientRequest} req 
    * @param {http.ServerResponse} res 
    * @param {object} ctx 
@@ -411,6 +415,7 @@ class Dingus {
 
   /**
    * Read and parse request body data.
+   * Sets ctx.parsedBody, and optionally ctx.rawBody.
    * @param {http.ClientRequest} req
    * @param {http.ServerResponse} res
    * @param {object} ctx
@@ -454,6 +459,7 @@ class Dingus {
 
   /**
    * Set the best content type for the response.
+   * Sets ctx.responseType, and Content-Type header.
    * @param {string[]} responseTypes default first
    * @param {http.ClientRequest} req 
    * @param {http.ServerResponse} res 
@@ -475,7 +481,7 @@ class Dingus {
 
 
   /**
-   * Inserts an encoding
+   * Inserts an encoding into Content-Encoding header.
    * @param {http.ServerResponse} res
    * @param {string} encoding
    */