mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 06:08:50 +02:00
http: improve parser error messages
Include the library-provided reason in the Error’s `message`. Fixes: https://github.com/nodejs/node/issues/28468 PR-URL: https://github.com/nodejs/node/pull/28487 Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
fd23c12263
commit
ba565a3734
8 changed files with 49 additions and 6 deletions
|
@ -13,7 +13,7 @@ server.on('clientError', common.mustCall(function(err, socket) {
|
|||
assert.strictEqual(err instanceof Error, true);
|
||||
assert.strictEqual(err.code, 'HPE_INVALID_METHOD');
|
||||
assert.strictEqual(err.bytesParsed, 1);
|
||||
assert.strictEqual(err.message, 'Parse Error');
|
||||
assert.strictEqual(err.message, 'Parse Error: Invalid method encountered');
|
||||
assert.strictEqual(err.rawPacket.toString(), 'Oopsie-doopsie\r\n');
|
||||
|
||||
socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue