From 01dd6a33c512acd55bdef1dcb8417edbf2e8d676 Mon Sep 17 00:00:00 2001 From: Jonathan Ong Date: Thu, 5 Jun 2014 16:19:29 -0700 Subject: [PATCH] context: delegate etag/last-modified --- lib/context.js | 6 +++--- lib/response.js | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/context.js b/lib/context.js index 1e2f0b7..4913a35 100644 --- a/lib/context.js +++ b/lib/context.js @@ -139,10 +139,10 @@ delegate(proto, 'response') .access('body') .access('length') .access('type') + .access('lastModified') + .access('etag') .getter('headerSent') - .getter('writable') - .setter('lastModified') - .setter('etag'); + .getter('writable'); /** * Request delegation. diff --git a/lib/response.js b/lib/response.js index 5ef6708..69732c2 100644 --- a/lib/response.js +++ b/lib/response.js @@ -321,6 +321,17 @@ module.exports = { this.set('ETag', val); }, + /** + * Get the ETag of a response. + * + * @return {String} + * @api public + */ + + get etag() { + return this.get('ETag'); + }, + /** * Return the request mime type void of * parameters such as "charset".