Skip to content

Commit f8b7b0f

Browse files
committed
Add integration tests, fix a minor bug en route
The spec says empty bodies may not have a signature. Previously this would crash the non-streaming parser (the streaming equivalent already handled this). That's now fixed. Tests are intended to provide a basic integration coverage over the whole project so we can change things with some idea that the whole setup still works.
1 parent 7cff402 commit f8b7b0f

File tree

3 files changed

+1836
-1
lines changed

3 files changed

+1836
-1
lines changed

lib/message.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ module.exports.unmarshall = function unmarshall(buff, opts) {
7272
message.flags = headers[2];
7373
message.serial = headers[5];
7474
msgBuf.align(3);
75-
message.body = msgBuf.read(message.signature);
75+
var bodyLength = headers[4];
76+
if (bodyLength > 0 && message.signature) {
77+
message.body = msgBuf.read(message.signature);
78+
}
7679
return message;
7780
};
7881

0 commit comments

Comments
 (0)