We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Users of Amqp-0-9-1.js cannot use the default exchange or empty-string routing keys.
Amqp-0-9-1.js
This is because the guards are too strict. For example in publishBasic(...):
publishBasic(...)
if (!exchange || typeof exchange != 'string') { throw new Error("AmqpChannel.publishBasic(): String parameter \'exchange\' is required"); } if (!routingKey || typeof routingKey != 'string') { throw new Error("AmqpChannel.publishBasic(): String parameter \'routingKey\' is required"); }
They are too strict because the empty-string '' is a falsy value in JavaScript (see: https://developer.mozilla.org/en-US/docs/Glossary/Falsy)
''
!'' === true
I would suggest changing guards, where the empty-string should be allowed, to something like the following:
if (exchange == null || exchange == undefined || typeof exchange != 'string') { throw new Error("AmqpChannel.publishBasic(): String parameter \'exchange\' is required"); } if (routingKey == null || routingKey == undefined || typeof routingKey != 'string') { throw new Error("AmqpChannel.publishBasic(): String parameter \'routingKey\' is required"); }
The text was updated successfully, but these errors were encountered:
BTW the guards are only applied when the configuration object style calling is used.
Sorry, something went wrong.
No branches or pull requests
Users of
Amqp-0-9-1.js
cannot use the default exchange or empty-string routing keys.This is because the guards are too strict. For example in
publishBasic(...)
:They are too strict because the empty-string
''
is a falsy value in JavaScript (see: https://developer.mozilla.org/en-US/docs/Glossary/Falsy)I would suggest changing guards, where the empty-string should be allowed, to something like the following:
The text was updated successfully, but these errors were encountered: