Closed pusateri closed 6 years ago
I think this failed on Node 4.0 because Buffer.from() was introduced in node 5.10.0.
I don't want to copy the Buffer (which Buffer.from alleviates) so you can wait until 4-30-2018 when Node 4.0 is EOL if you want to merge this. Alternatively, we can drop Node 4.0 support early.
Buffer.from() should be working fine in Node 4.0 with safe-buffer. According to this: https://github.com/feross/safe-buffer/pull/5 There must be another problem it failed in 4.0.
This is failing in safe-buffer:
Buffer.from(sbuf.buffer, sbuf.byteOffset + 2, sbuf.byteLength - 2)
Line 830
Maybe I can rewrite it to make it work with safe-buffer.
This is failing in safe-buffer:
Buffer.from(sbuf.buffer, sbuf.byteOffset + 2, sbuf.byteLength - 2)
Interesting. May be worth to report at https://github.com/feross/safe-buffer
Stream encode/decode worked fine for minimal responses but more complicated responses got corrupted because the buffer wasn't constructed correctly. This adds a test case to catch the problem and then fixes it. I also removed the streamDecode.bytes test because there is nothing to compare it to that makes sense.