Skip to content
Myr

refactored `res.redirect()` slightly

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

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent a3cddb8 · Browse files · 1 file+3 added−2 removed
This commit

State

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

Diff stats

1 file+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:lib/response.js+3 added-2 removed
12 unmodified lines
13 , http = require('http')14 , path = require('path')15 , connect = require('connect')16 , utils = connect.utils17 , statusCodes = http.STATUS_CODES18 , parseRange = require('./utils').parseRange19 , res = http.ServerResponse.prototype20 , send = connect.static.send21 , mime = require('mime')
370 unmodified lines
392 393394 // Support text/{plain,html} by default395 if (req.accepts('html')) {395 body = '<p>' + http.STATUS_CODES[status] + '. Redirecting to <a href="' + url + '">' + url + '</a></p>';396 body = '<p>' + statusCodes[status] + '. Redirecting to <a href="' + url + '">' + url + '</a></p>';397 this.header('Content-Type', 'text/html');398 } else {398 body = http.STATUS_CODES[status] + '. Redirecting to ' + url;399 body = statusCodes[status] + '. Redirecting to ' + url;400 this.header('Content-Type', 'text/plain');401 }402403 // Respond
4 unmodified lines