@@ -82,6 +82,9 @@ res.send = function(body){
82
82
, head = 'HEAD' == req . method
83
83
, len ;
84
84
85
+ // settings
86
+ var app = this . app ;
87
+
85
88
// allow status / body
86
89
if ( 2 == arguments . length ) {
87
90
// res.send(body, status) backwards compat
@@ -128,7 +131,7 @@ res.send = function(body){
128
131
129
132
// ETag support
130
133
// TODO: W/ support
131
- if ( len > 1024 ) {
134
+ if ( app . settings . etag && len > 1024 ) {
132
135
if ( ! this . get ( 'ETag' ) ) {
133
136
this . set ( 'ETag' , etag ( body ) ) ;
134
137
}
@@ -241,7 +244,7 @@ res.jsonp = function(obj){
241
244
242
245
/**
243
246
* Transfer the file at the given `path`.
244
- *
247
+ *
245
248
* Automatically sets the _Content-Type_ response header field.
246
249
* The callback `fn(err)` is invoked when the transfer is complete
247
250
* or when an error occurs. Be sure to check `res.sentHeader`
@@ -263,7 +266,7 @@ res.jsonp = function(obj){
263
266
* app.get('/user/:uid/photos/:file', function(req, res){
264
267
* var uid = req.params.uid
265
268
* , file = req.params.file;
266
- *
269
+ *
267
270
* req.user.mayViewFilesFrom(uid, function(yes){
268
271
* if (yes) {
269
272
* res.sendfile('/uploads/' + uid + '/' + file);
@@ -408,11 +411,11 @@ res.type = function(type){
408
411
* 'text/plain': function(){
409
412
* res.send('hey');
410
413
* },
411
- *
414
+ *
412
415
* 'text/html': function(){
413
416
* res.send('<p>hey</p>');
414
417
* },
415
- *
418
+ *
416
419
* 'appliation/json': function(){
417
420
* res.send({ message: 'hey' });
418
421
* }
@@ -425,11 +428,11 @@ res.type = function(type){
425
428
* text: function(){
426
429
* res.send('hey');
427
430
* },
428
- *
431
+ *
429
432
* html: function(){
430
433
* res.send('<p>hey</p>');
431
434
* },
432
- *
435
+ *
433
436
* json: function(){
434
437
* res.send({ message: 'hey' });
435
438
* }
@@ -498,15 +501,15 @@ res.attachment = function(filename){
498
501
* res.set('Accept', 'application/json');
499
502
* res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
500
503
*
501
- * Aliased as `res.header()`.
504
+ * Aliased as `res.header()`.
502
505
*
503
506
* @param {String|Object } field
504
507
* @param {String } val
505
508
* @return {ServerResponse } for chaining
506
509
* @api public
507
510
*/
508
511
509
- res . set =
512
+ res . set =
510
513
res . header = function ( field , val ) {
511
514
if ( 2 == arguments . length ) {
512
515
this . setHeader ( field , '' + val ) ;
@@ -602,7 +605,7 @@ res.cookie = function(name, val, options){
602
605
* Mounting:
603
606
*
604
607
* When an application is mounted, and `res.redirect()`
605
- * is given a path that does _not_ lead with "/". For
608
+ * is given a path that does _not_ lead with "/". For
606
609
* example suppose a "blog" app is mounted at "/blog",
607
610
* the following redirect would result in "/blog/login":
608
611
*
0 commit comments