http-server
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -21,5 +21,16 @@ var fs = require('fs'), | ||
} | ||
if (options.headers) { | ||
this.headers = options.headers; | ||
} | ||
this.cache = options.cache || 3600; // in seconds. | ||
this.autoIndex = options.autoIndex !== false; | ||
if (options.ext) { | ||
this.ext = options.ext === true | ||
? 'html' | ||
: options.ext; | ||
} | ||
this.server = union.createServer({ | ||
@@ -29,5 +40,7 @@ before: [ | ||
autoIndex: this.autoIndex, | ||
cache: this.cache | ||
cache: this.cache, | ||
defaultExt: this.ext | ||
}) | ||
] | ||
], | ||
headers: this.headers || {} | ||
}); | ||
@@ -34,0 +47,0 @@ }; |
{ | ||
"name": "http-server", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"author": "Nodejitsu <support@nodejitsu.com>", | ||
@@ -57,3 +57,4 @@ "description": "a simple zero-configuration command-line http server", | ||
"union": "0.1.x", | ||
"ecstatic": "0.1.x" | ||
"ecstatic": "0.1.x", | ||
"portfinder": "~0.2.1" | ||
}, | ||
@@ -60,0 +61,0 @@ "devDependencies": { |
@@ -14,3 +14,7 @@ var assert = require('assert'), | ||
var server = httpServer.createServer({ | ||
root: root | ||
root: root, | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Credentials': 'true' | ||
} | ||
}); | ||
@@ -56,5 +60,13 @@ server.listen(8080); | ||
} | ||
}, | ||
'and options include custom set http-headers': { | ||
topic: function () { | ||
request('http://127.0.0.1:8080/', this.callback); | ||
}, | ||
'should respond with headers set in options': function (err, res, body) { | ||
assert.equal(res.headers['access-control-allow-origin'], '*'); | ||
assert.equal(res.headers['access-control-allow-credentials'], 'true'); | ||
} | ||
} | ||
} | ||
}).export(module); | ||
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
482241
116
0
5
1
+ Addedportfinder@~0.2.1
+ Addedmkdirp@0.0.7(transitive)
+ Addedportfinder@0.2.1(transitive)