Skip to content
Myr

Moving more helpers to Request methods

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

authored by visionmedia · committed by visionmedia · parent 34c412e · Browse files · 2 files+43 added−39 removed
This commit

State

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

Diff stats

2 files+43 added−39 removed

  • other:+43 added−39 removed

2 files+43 added−39 removed

modified:lib/express/helpers.js-39 removed
88 unmodified lines
89 return path.slice(path.lastIndexOf('.') + 1)90}9192/**93 * Return a param _key_ value or null.94 *95 * @param {string} key96 * @return {string}97 * @api public98 */99100exports.param = function(key) {101 return Express.server.request.params[key] ||102 Express.server.request.uri.post[key] ||103 Express.server.request.uri.params[key]104}105106/**107 * Check if Accept header includes the mime type108 * for the given _path_, which calls mime().109 *110 * @param {string} path111 * @see mime()112 * @api public113 */114115exports.accepts = function(path) {116 return header('accept').indexOf(mime(path)) != -1117}118119/**120 * Set response status to _code_.121 *122 * @param {int} code123 * @return {int}124 * @api public125 */126127var status = exports.status = function(code) {128 return Express.server.response.status = code129}130131/**93 * Immediately respond with response _code_ and _body_.94 * The status _code_ defaults to to 404, and _body_ will95 * default to the default body associated with the response96 * _code_.
134 unmodified lines
modified:lib/express/request.js+43 added