code: function handleRequest(body, methods, req, res, session) {
    var isBatch = Array.isArray(body);
    session = session || {};
    session.httpRequest = req;
    var reqs = isBatch ? body : [body];
    var p = Promise.all(setup(reqs, methods, session)).then(
     function (result) {
       if (methods.__post)
         result = methods.__post(result, session);
       //filter out notification results (they won't have an id)
       result = result.filter(function(elem){
         var keep = !!elem.id;
         return keep;
       });
       if (!result.length) {
         return null;
       }
       if (!isBatch && result.length == 1)
         return result[0];
       return result;
    });
    if (res) {
      p = p.then(function(result) {
        if (result) {
          var rpcResponse = (methods.__stringify || JSON.stringify)(result);
          var contentLength = Buffer.byteLength(rpcResponse);
          res.writeHead(contentLength ? 200 : 204, {
            'Content-Length': String(contentLength),
            'Content-Type': 'application/json'
          });
          res.end(rpcResponse);
        } else {
          res.end();
        }
      });
    }
    return p;
  }
docs: @param {Object or Array} [body] The jsonrpc request
  @param {Object} [methods] Object JSON RPC methods to invoke
  @param {Object} [req] HTTP request that is the source of the jsonrpc, passed to method (optional)
  
  Returns a promise that resolves to the JSON RPC response. Maybe null if the request only contained notifications.