Skip to content
New issue

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

Avoid mutating header objects passed as arguments #107

Open
wemrysi opened this issue Mar 18, 2015 · 1 comment
Open

Avoid mutating header objects passed as arguments #107

wemrysi opened this issue Mar 18, 2015 · 1 comment

Comments

@wemrysi
Copy link
Contributor

wemrysi commented Mar 18, 2015

Currently, Frame.toString, Client.connect, Client.send, Client.subscribe, Client.ack and Client.nack mutate the headers argument they are invoked with. This causes very subtle bugs in client code as these objects are modified without the caller's knowledge.

Instead, a copy of the headers should be made for the purpose of modification, leaving the original in tact.

@Forusim
Copy link

Forusim commented Jul 8, 2015

Noticed the same issue.
My workaround:

function headers() { return { persistent: true }; }

client.subscribe('/queue/test', on_message, headers());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants