Skip to content

Add support for Node 10.12.x. #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
language: node_js
node_js:
- '10'
- '8'
- '6'
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# HTTP Parser

## 0.5.1

Add TravisCI Nodejs 10 and 8.
Improved/fixed unit tests for running on Node.js 10.

## 0.4.4

Made 'maxHeaderSize' configurable.
Expand All @@ -11,4 +16,4 @@ require('http-parser-js').HTTPParser.maxHeaderSize = 1024 * 1024; // 1MB instead

var http = require('http');
// ...
```
```
2 changes: 1 addition & 1 deletion tests/parallel/test-http-invalid-urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function test(host) {
[http, https].forEach((module) => {
assert.throws(() => module[method](host, () => {
throw new Error(`${module}.${method} should not connect to ${host}`);
}), error);
}), error + " " + host);
});
});
}
Expand Down
2 changes: 1 addition & 1 deletion tests/parallel/test-http-request-end-twice.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var server = http.Server(function(req, res) {
server.listen(0, function() {
var req = http.get({port: this.address().port}, function(res) {
res.on('end', function() {
assert.ok(!req.end());
assert.ok(process.version.startsWith("v10.") ? req.end() : !req.end());
server.close();
});
res.resume();
Expand Down
3 changes: 2 additions & 1 deletion tests/parallel/test-http-server-multiheaders2.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ var srv = http.createServer(function(req, res) {
'foo', 'header parsed incorrectly: ' + header);
});
multipleAllowed.forEach(function(header) {
const sep = (process.version < 'v8.0') ? ', ' : (header.toLowerCase() === 'cookie' ? '; ' : ', ');
const sep = (parseInt(process.versions.node[0] + "" + process.versions.node[1]) < 8) ? ', ' : (header.toLowerCase() === 'cookie' ? '; ' : ', ');

assert.strictEqual(req.headers[header.toLowerCase()], `foo${sep}bar`,
`header parsed incorrectly: ${header}`);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/parallel/test-http-unix-socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ server.listen(common.PIPE, function() {
server.close(function(error) {
assert.equal(error, undefined);
server.close(function(error) {
assert.equal(error && error.message, 'Not running');
assert.equal(error && error.message, process.version.startsWith("v10.") ? "Server is not running." : 'Not running');
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion tests/parallel/test-http-write-head.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var s = http.createServer(function(req, res) {
res.setHeader('foo', undefined);
} catch (e) {
assert.ok(e instanceof Error);
assert.ok(e.message.indexOf('"value"') != -1);
assert.ok(e.message.indexOf('value') != -1);
threw = true;
}
assert.ok(threw, 'Undefined value should throw');
Expand Down