More request specific refactoring
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parent ca3f525 · Browse files · 5 files·+9 added−17 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+9 added−17 removed
- other:+9 added−17 removed
Provenance
- Commit
a499d15- Tree
e01e2ab- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent
ca3f525
5 files changed+9 added−17 removed
modified:lib/express/plugins/common-logger.js+4 added-9 removed
12345456723 unmodified lines31323334373839403536373839454647404142434445
// Express - CommonLogger - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
// TODO: abstract into date formatting library
/** * Months. */
23 unmodified lines exports.CommonLogger = Plugin.extend({ on: { response: function(event) { var response = event.response, request = event.request, uri = request.uri, headers = request.headers puts([headers.host, '-', '-', '[' + format(new Date) + ']', '"' + event.request.method.toUpperCase() + ' ' + (event.request.uri.path || '/') + '"' + request.method.toUpperCase() + ' ' + (uri.path || '/') + ' HTTP/' + request.httpVersion + '"', response.status, response.headers['content-length'] || 0].join(' ')) ' HTTP/' + event.request.httpVersion + '"', event.request.response.status, event.request.response.headers['content-length'] || 0].join(' ')) } }})No newline at end of fileNo newline at end of filemodified:lib/express/plugins/content-length.js+1 added-1 removed
2 unmodified lines3456778910112 unmodified lines2 unmodified lines
exports.ContentLength = Plugin.extend({ on: { response: function(event) { var response = event.response var response = event.request.response response.headers['content-length'] = response.headers['content-length'] || response.body.length }2 unmodified linesmodified:lib/express/plugins/method-override.js+1 added-1 removed
2 unmodified lines3456778910112 unmodified lines
exports.MethodOverride = Plugin.extend({ on: { request: function(event) { if (param('__method__')) if (event.request.param('__method__')) event.request.method = param('__method__').toLowerCase() } }})No newline at end of fileNo newline at end of filemodified:lib/express/plugins/redirect.js+2 added-5 removed
32 unmodified lines333435363738394041373839404132 unmodified lines
exports.Redirect = Plugin.extend({ on: { request: function(event) { home = set('home') || set('basepath') || '/' back = header('referrer') || header('referer') event.request.home = set('home') || set('basepath') || '/' event.request.back = event.request.header('referrer') || event.request.header('referer') } }})No newline at end of fileNo newline at end of filemodified:lib/express/event.js+1 added-1 removed
21 unmodified lines22232425262627282921 unmodified lines * @return {string} * @api public */ string: function() { toString: function() { return '[Event ' + this.name + ']' }})No newline at end of fileNo newline at end of file