Skip to content

Commit

Permalink
fix: allow empty payloads (#942)
Browse files Browse the repository at this point in the history
  • Loading branch information
cody-greene committed Nov 7, 2022
1 parent 68642b9 commit af1e3ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/queue.js
Expand Up @@ -32,9 +32,6 @@ const queue = (options) => {
const onMessage = (msg) => {

const data = parseMessage(msg);
if (!data) {
return;
}

const ack = (reply) => {

Expand Down
13 changes: 13 additions & 0 deletions test/queue.test.js
Expand Up @@ -101,6 +101,19 @@ describe('queue', () => {
exchange.publish(message, { key: name });
});
});

it('consumes empty payloads', (done) => {

queue.consume((data) => {

Assert.equal(data, null);
done();
});
queue.on('ready', () => {

exchange.publish(null, { key: name });
});
});
});

describe('cancel', () => {
Expand Down

0 comments on commit af1e3ae

Please sign in to comment.