From f96164737756db25ab6924da8a3eeb5ff86b1029 Mon Sep 17 00:00:00 2001 From: Jonathan Ong Date: Wed, 23 Oct 2013 23:54:07 -0700 Subject: [PATCH] add additional node.js aliases --- lib/context.js | 57 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/lib/context.js b/lib/context.js index 6c6e6bc..0761774 100644 --- a/lib/context.js +++ b/lib/context.js @@ -110,7 +110,7 @@ module.exports = { get status() { return this.res.statusCode; }, - + get statusCode() { return this.res.statusCode; }, @@ -134,7 +134,7 @@ module.exports = { var noContent = 304 == this.status || 204 == this.status; if (noContent && this.body) this.body = null; }, - + set statusCode(val) { this.status = val; }, @@ -614,7 +614,7 @@ module.exports = { get headerSent() { return this.res.headersSent; }, - + get headersSent() { return this.res.headersSent; }, @@ -896,6 +896,57 @@ module.exports = { } }, + setHeader: function(field, val){ + this.set(field, val); + }, + + /** + * Get the current response header `name`. + * + * @param {String} name + * @api public + */ + + getHeader: function(name){ + return this.res.getHeader(name); + }, + + /** + * Remove the current response header `name`. + * + * @param {String} name + * @api public + */ + + removeHeader: function(name){ + return this.res.removeHeader(name); + }, + + /** + * Get the trailing headers to a request. + * + * @param {Object} + * @api public + */ + + get trailers() { + return this.req.trailers; + }, + + /** + * Add trailing headers to the response. + * + * Maybe: + * - throw if not chunked encoding + * + * @param {object} headers + * @api public + */ + + addTrailers: function(headers){ + return this.res.addTrailers(headers); + }, + /** * Append `val` to header `field`. *