-
Notifications
You must be signed in to change notification settings - Fork 56
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
New feature: could you add option to set default headers? #47
Comments
We are trying to update everything to work with the new sails.io.js abilities while still working for older sails.io.js. Headers is one of the things that is involved with this. Its in the works along with full test suites for more code confidence as its a lot of changes. |
See; https://github.com/janpantel/angular-sails/blob/master/src/service/angular-sails.js#L67 |
That will not work because angular-sails uses sails.io.js. sails.io.js will just ignore the headers when it makes the actual call. See: https://github.com/balderdashy/sails.io.js/blob/master/sails.io.js#L725 |
Is token based Authentication currently possible with angular-sails.., it needs the authorization header? |
headers (and thus setting the auth header) is on the roadmap for 2.0 which is not 100% ready(the build is passing and what is there works, but not feature complete), but close. |
Oh rlly? No header support? Looked into my sails project: Ive a |
Any update on the progress on this? |
+1 |
1 similar comment
+1 |
I was going to mention beta release of 2.0 and say that it has default headers... but it has been a while since I made it and looking at it now I see.... But while I'm at it... RFC for what the default default headers should be (if any). Angular's |
So... there is now 2.0 beta 2 release. It has default headers abilities similar to how angular's Let me know if you have any issues with 2.0 beta. |
I have just tested this with the following from an AuthService: $sails.defaults.headers.common = {'Authorization' : 'Bearer ' + token}; Checking the socket frames in chrome devtools I can see that the headers appear to be empty. |
Is it possible to automatically append the http headers to the socket, which means we just have to replace the $http with $sails? |
@snowcxt not sure what you mean. Something like "use the headers set in
Each one extending the other to add or override the values. That could be useful when you want to use both Although you could just do |
Right. And it's nice to have the "headers" parameter in the $sails function as what $http does. |
@AdamJessop It turns out that if I don't actually update the dist files, then no one gets them :( lol.. yeah, I forgot to run gulp to create the dist files that you use. So 2.0.0-beta-2 dist files are actually 1.x... No fear, 2.0.0-beta.3 has the legit dist files now and you should be able to see the headers working! Give it a try. @snowcxt as far as your request. I would probably put that ability behind a flag, and if I were to do that and have users/devs set the flag, I might as well just recommend doing |
Has this feature been implemented yet ? Doesn't look like it has, but I may be wrong ... |
Any update on this? |
angularSails supports setting of default headers, could angular-sails also support that?
Check http://balderdashy.github.io/angularSails/#/api/ngsails.$sailsSocket, under Setting Headers.
By the way, awesome library, has nice documentation and everything, I like it much more than angularSails.
Thanks!
The text was updated successfully, but these errors were encountered: