mirror of
https://github.com/d0zingcat/cors-anywhere.git
synced 2026-05-31 07:26:54 +00:00
Fix failing tests for 0.10.x, 4.x and 5.x
Travis build failed on "Uncaught TypeError: Object.keys called on non-object". That's a real error (res._headers was initially null until a header is set).
This commit is contained in:
10
test/test.js
10
test/test.js
@@ -392,6 +392,16 @@ describe('Proxy errors', function() {
|
||||
});
|
||||
|
||||
it('Invalid HTTP status code', function(done) {
|
||||
// Strict HTTP status validation was introduced in Node 4.5.5+, 5.11.0+.
|
||||
// https://github.com/nodejs/node/pull/6291
|
||||
var nodev = process.versions.node.split('.').map(function(v) { return parseInt(v); });
|
||||
if (nodev[0] < 4 ||
|
||||
nodev[0] === 4 && nodev[1] < 5 ||
|
||||
nodev[0] === 4 && nodev[1] === 5 && nodev[2] < 5 ||
|
||||
nodev[0] === 5 && nodev[1] < 11) {
|
||||
this.skip();
|
||||
}
|
||||
|
||||
var errorMessage = 'RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: 0';
|
||||
if (parseInt(process.versions.node, 10) < 9) {
|
||||
errorMessage = 'RangeError: Invalid status code: 0';
|
||||
|
||||
Reference in New Issue
Block a user