Skip to content
Myr

renamed `res.respondTo()` to `res.format()`

Before adoption: this commit came in with the history the project adopted, so no landing records it.

since you are not really responding with it, its basically as switch

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent a47660b · Browse files · 3 files+83 added−83 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+83 added−83 removed

  • tests:+80 added−80 removed
  • other:+3 added−3 removed

3 files+83 added−83 removed

modified:lib/response.js+3 added-3 removed
298 unmodified lines
299 * 406 "Not Acceptable".300 *301 * Examples:302 *303 * res.respondTo({303 * res.format({304 * 'text/plain': function(){305 * res.type('text').send('hey');306 * },307 *
10 unmodified lines
318 * @return {ServerResponse} for chaining319 * @api public320 */321322res.respondTo = function(obj){322res.format = function(obj){323 var keys = Object.keys(obj)324 , req = this.req325 , next = req.next326 , accepted = req.accepted
213 unmodified lines
540 url = req.protocol + '://' + host + url;541 }542543 // Support text/{plain,html} by default544 this.respondTo({544 this.format({545 'text/plain': function(){546 body = statusCodes[status] + '. Redirecting to ' + url;547 },548
81 unmodified lines
added:test/res.format.js+80 added
deleted:test/res.respondTo.js-80 removed