Skip to content

Commit

Permalink
Fix failing encode/decode test on node 20.x (#1480)
Browse files Browse the repository at this point in the history
Fix failing encode /decode test on node 20.x
  • Loading branch information
dbaeumer authored May 21, 2024
1 parent 63a95ae commit f4da232
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jsonrpc/src/node/test/messages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,10 @@ suite('Messages', () => {
assert.strictEqual(message.method, 'example');
done();
});
const zipped = zlib.gzipSync(Buffer.from('{"jsonrpc":"2.0","id":1,"method":"example"}', 'utf8'));
const payload = Buffer.concat([
Buffer.from('Content-Encoding: gzip\r\nContent-Length: 61\r\n\r\n', 'ascii'),
zlib.gzipSync(Buffer.from('{"jsonrpc":"2.0","id":1,"method":"example"}', 'utf8'))
Buffer.from(`Content-Encoding: gzip\r\nContent-Length: ${zipped.byteLength}\r\n\r\n`, 'ascii'),
zipped
]);
readable.push(payload);
readable.push(null);
Expand Down

0 comments on commit f4da232

Please sign in to comment.