http-server
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -0,3 +1,4 @@ | ||
'use strict'; | ||
var fs = require('fs'), | ||
util = require('util'), | ||
union = require('union'), | ||
@@ -8,3 +9,22 @@ ecstatic = require('ecstatic'), | ||
var HTTPServer = exports.HTTPServer = function (options) { | ||
// | ||
// Remark: backwards compatibility for previous | ||
// case convention of HTTP | ||
// | ||
exports.HttpServer = exports.HTTPServer = HttpServer; | ||
/** | ||
* Returns a new instance of HttpServer with the | ||
* specified `options`. | ||
*/ | ||
exports.createServer = function (options) { | ||
return new HttpServer(options); | ||
}; | ||
/** | ||
* Constructor function for the HttpServer object | ||
* with is responsible for serving static files along | ||
* with other HTTP-related features. | ||
*/ | ||
function HttpServer(options) { | ||
options = options || {}; | ||
@@ -97,2 +117,3 @@ | ||
} | ||
res.end(); | ||
@@ -107,14 +128,10 @@ } | ||
this.server = union.createServer(serverOptions); | ||
}; | ||
} | ||
HTTPServer.prototype.listen = function () { | ||
HttpServer.prototype.listen = function () { | ||
this.server.listen.apply(this.server, arguments); | ||
}; | ||
HTTPServer.prototype.close = function () { | ||
HttpServer.prototype.close = function () { | ||
return this.server.close(); | ||
}; | ||
exports.createServer = function (options) { | ||
return new HTTPServer(options); | ||
}; |
{ | ||
"name": "http-server", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "A simple zero-configuration command-line http server", | ||
@@ -16,3 +16,3 @@ "main": "./lib/http-server", | ||
"start": "node ./bin/http-server", | ||
"pretest": "stylezero bin/ lib/ test", | ||
"pretest": "common bin/http-server lib/ test", | ||
"test": "vows --spec --isolate" | ||
@@ -58,3 +58,3 @@ }, | ||
"name": "Jinkwon Lee", | ||
"email" : "master@bdyne.net" | ||
"email": "master@bdyne.net" | ||
} | ||
@@ -73,5 +73,5 @@ ], | ||
"devDependencies": { | ||
"vows": "0.7.x", | ||
"common-style": "^3.0.0", | ||
"request": "2.49.x", | ||
"stylezero": "2.2.0" | ||
"vows": "0.7.x" | ||
}, | ||
@@ -85,4 +85,4 @@ "bugs": { | ||
"http-server": "./bin/http-server", | ||
"hs" : "./bin/http-server" | ||
"hs": "./bin/http-server" | ||
} | ||
} |
@@ -74,3 +74,3 @@ var assert = require('assert'), | ||
}, | ||
'should respond with headers set in options': function (err, res, body) { | ||
'should respond with headers set in options': function (err, res) { | ||
assert.equal(res.headers['access-control-allow-origin'], '*'); | ||
@@ -150,3 +150,3 @@ assert.equal(res.headers['access-control-allow-credentials'], 'true'); | ||
}, | ||
'status code should be 204': function (err, res, body) { | ||
'status code should be 204': function (err, res) { | ||
assert.equal(res.statusCode, 204); | ||
@@ -153,0 +153,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
490593
261