[Pkg-javascript-commits] [node-static] 82/151: Merges pull request #72

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Tue Jan 7 23:18:00 UTC 2014


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch master
in repository node-static.

commit a32c7905de8e2fd28ff1f7af56aaf7edc9b750dc
Author: Pablo Cantero <pablo at pablocantero.com>
Date:   Fri Oct 12 22:21:56 2012 -0300

    Merges pull request #72
---
 lib/node-static.js                   | 21 +++++++++++++--------
 test/integration/node-static-test.js | 12 ++++++------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/lib/node-static.js b/lib/node-static.js
index de4ef3b..d06fd08 100644
--- a/lib/node-static.js
+++ b/lib/node-static.js
@@ -1,9 +1,9 @@
-var fs = require('fs'),
-    events = require('events'),
-    buffer = require('buffer'),
-    http = require('http'),
-    url = require('url'),
-    path = require('path');
+var fs     = require('fs')
+  , events = require('events')
+  , buffer = require('buffer')
+  , http   = require('http')
+  , url    = require('url')
+  , path   = require('path');
 
 exports.version = [0, 6, 0];
 
@@ -31,13 +31,13 @@ exports.Server = function (root, options) {
             this.cache = false;
         }
     }
-    
+
     if ('serverInfo' in this.options) {
         this.serverInfo = this.options.serverInfo.toString();
     } else {
         this.serverInfo = 'node-static/' + exports.version.join('.');
     }
-    
+
     this.defaultHeaders['Server'] = this.serverInfo;
 
     if (this.cache !== false) {
@@ -77,6 +77,7 @@ exports.Server.prototype.serveDir = function (pathname, req, res, finish) {
         });
     }
 };
+
 exports.Server.prototype.serveFile = function (pathname, status, headers, req, res) {
     var that = this;
     var promise = new(events.EventEmitter);
@@ -93,6 +94,7 @@ exports.Server.prototype.serveFile = function (pathname, status, headers, req, r
     });
     return promise;
 };
+
 exports.Server.prototype.finish = function (status, headers, req, res, promise, callback) {
     var result = {
         status:  status,
@@ -156,9 +158,11 @@ exports.Server.prototype.servePath = function (pathname, status, headers, req, r
     }
     return promise;
 };
+
 exports.Server.prototype.resolve = function (pathname) {
     return path.resolve(path.join(this.root, pathname));
 };
+
 exports.Server.prototype.serve = function (req, res, callback) {
     var that = this,
         promise = new(events.EventEmitter);
@@ -258,3 +262,4 @@ exports.Server.prototype.stream = function (pathname, files, buffer, res, callba
         }
     })(files.slice(0), 0);
 };
+
diff --git a/test/integration/node-static-test.js b/test/integration/node-static-test.js
index 5501343..22da865 100644
--- a/test/integration/node-static-test.js
+++ b/test/integration/node-static-test.js
@@ -1,9 +1,9 @@
-var vows = require('vows')
-	, request = require('request')
-	, assert = require('assert')
-	,	static = require('../../lib/node-static');
+var vows    = require('vows')
+  , request = require('request')
+  , assert  = require('assert')
+  , static  = require('../../lib/node-static');
 
-var fileServer = new(static.Server)(__dirname + '/../fixtures', {serverInfo: "custom-server-name"});
+var fileServer = new(static.Server)(__dirname + '/../fixtures', {serverInfo: 'custom-server-name'});
 
 var suite = vows.describe('node-static');
 
@@ -109,7 +109,7 @@ suite.addBatch({
       request.head(TEST_SERVER + '/index.html', this.callback);
     },
     'should respond with node-static/0.6.0' : function(error, response, body){
-      assert.equal(response.headers["server"], "custom-server-name");
+      assert.equal(response.headers['server'], 'custom-server-name');
     } 
   }
 }).export(module);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-static.git



More information about the Pkg-javascript-commits mailing list