diff --git a/lib/response.js b/lib/response.js index 4bd8f89d..49473e4c 100644 --- a/lib/response.js +++ b/lib/response.js @@ -300,7 +300,7 @@ res.type = function(type){ * * Examples: * - * res.respondTo({ + * res.format({ * 'text/plain': function(){ * res.type('text').send('hey'); * }, @@ -319,7 +319,7 @@ res.type = function(type){ * @api public */ -res.respondTo = function(obj){ +res.format = function(obj){ var keys = Object.keys(obj) , req = this.req , next = req.next @@ -541,7 +541,7 @@ res.redirect = function(url){ } // Support text/{plain,html} by default - this.respondTo({ + this.format({ 'text/plain': function(){ body = statusCodes[status] + '. Redirecting to ' + url; }, diff --git a/test/res.respondTo.js b/test/res.format.js similarity index 97% rename from test/res.respondTo.js rename to test/res.format.js index 0710f7de..8a320b8d 100644 --- a/test/res.respondTo.js +++ b/test/res.format.js @@ -7,7 +7,7 @@ var express = require('../') var app = express(); app.use(function(req, res, next){ - res.respondTo({ + res.format({ 'text/plain': function(){ res.send('hey'); }, @@ -30,7 +30,7 @@ app.use(function(err, req, res, next){ }) describe('req', function(){ - describe('.respondTo(obj)', function(){ + describe('.format(obj)', function(){ it('should utilize qvalues in negotiation', function(done){ request(app) .get('/')