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

Integration with matb33:collection-hooks #39

Open
petermikitsh opened this issue Jun 13, 2015 · 0 comments
Open

Integration with matb33:collection-hooks #39

petermikitsh opened this issue Jun 13, 2015 · 0 comments

Comments

@petermikitsh
Copy link

I'd like to access header information inside of collection hooks (which are called from publication functions).

Is this possible?

Here's what I've tried so far, but it doesn't seem to be working:

Meteor.startup(function() {
  Posts.before.find(function(userId, selector, options) {
    var self = this;
    console.log(headers.get(self, 'host'));
  });
});

And the exception thrown:

Exception from sub posts id pXwknxFQWfuwWjxhy Error: Call headers.get(this) only from within a method or publish function.  With callbacks / anonymous functions, use: var self=this; and call headers.get(self);
I20150613-14:53:11.801(-4)?     at checkSelf (packages/gadicohen:headers/headers-server.js:73:1)
I20150613-14:53:11.801(-4)?     at Object.headers.get (packages/gadicohen:headers/headers-server.js:82:1
...

Any help is appreciated! Thanks in advance.

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

1 participant