Stop sharing write headers across all instances of transports
diff --git a/lib/nodejs/test/header.test.js b/lib/nodejs/test/header.test.js
index efd7f81..99bb832 100644
--- a/lib/nodejs/test/header.test.js
+++ b/lib/nodejs/test/header.test.js
@@ -39,6 +39,19 @@
assert.equals(headers.Trace, "abcde");
assert.end();
},
+ "Should read different headers from different payload": function(assert) {
+ const transport = new TFramedTransport();
+ const buf = Buffer.from(headerPayload);
+ buf[24] = 115; // Change Parent to Parens
+ buf[32] = 122; // Change shoobar to shoobaz
+ transport.inBuf = buf;
+
+ const headers = transport.readHeaders();
+ assert.equals(headers.Parent, undefined);
+ assert.equals(headers.Parens, "shoobaz");
+ assert.equals(headers.Trace, "abcde");
+ assert.end();
+ },
"Should read headers when reading message begin": function(assert) {
const transport = new TFramedTransport();
transport.inBuf = Buffer.from(headerPayload);
@@ -70,6 +83,23 @@
assert.equals(headers.boobooboo, "fooshoopoo");
assert.equals(headers.a, "z");
assert.end();
+ },
+ "Separate transports should have separate headers": function(assert) {
+ const writeTransport = new TFramedTransport();
+ writeTransport.setProtocolId(THeaderTransport.SubprotocolId.BINARY);
+ writeTransport.setWriteHeader("foo", "bar");
+ const headers = writeTransport.getWriteHeaders();
+
+ const otherWriteTransport = new TFramedTransport();
+ otherWriteTransport.setProtocolId(THeaderTransport.SubprotocolId.BINARY);
+ otherWriteTransport.setWriteHeader("otherfoo", "baz");
+ const otherHeaders = otherWriteTransport.getWriteHeaders();
+
+ assert.equals(headers.foo, "bar");
+ assert.equals(headers.otherfoo, undefined);
+ assert.equals(otherHeaders.foo, undefined);
+ assert.equals(otherHeaders.otherfoo, "baz");
+ assert.end();
}
};