code: function returnRevision(req) {
      return (dbResult) => {
          if (dbResult.body && dbResult.body.items && dbResult.body.items.length) {
              const row = dbResult.body.items[0];
              const headers = Object.assign({}, row.headers || {}, {
                  etag: mwUtil.makeETag(row.rev, row.tid),
                  'content-type': row['content-type']
              });
              return {
                  status: 200,
                  headers,
                  body: row.value
              };
          } else {
              throw new HTTPError({
                  status: 404,
                  body: {
                      type: 'not_found',
                      uri: req.uri,
                      method: req.method
                  }
              });
          }
      };
  }
docs: Format a revision response. Shared between different ways to retrieve a revision (latest & with explicit revision).