Restangular.one with empty 2nd parameter
If I use by mistake Restangular.one('endpoint','').get(), then I lost the default header 'Authorization' in the GET request. Thus the API returns an 'unauthorized' error (401) instead of, for example, a 'bad request' error (400).
This sounds like a serverside problem, not a Restangular one? Can you elaborate on exactly what you're trying to do?
Simply using the one method, with no problem if the 2nd parameter has length. But if it is an empty string, by mistake, the 'Authorization' header isn't sent in the GET request received by the API (I'm looking for it in the PHP $_SERVER array because is running in a Nginx server, not Apache, and must use a custom getallheaders function, but the header is there if the parameter has length). The rest basic headears remains ok, that's the only change.
PS: The header is setted using Restangular.setDefaultHeaders({'Authorization': 'string'}); or $http.defaults.headers.common['Authorization']='string';
Ah. Okay. I understand now.
I tested this out in a Plunk and I don't seem to have the problem that you do. Can you take a look at this Plunk and let me know if this is what you're trying to do?
http://plnkr.co/edit/4iO7UyWjVAfgBsC7t9Ot?p=preview
Sorry, my bad. I returned to an old version of my code to do more tests and try to help with the "bug", but I found that was related to a timing problem with asynchronous threads. The empty string parameter is working as expected. I proceed to punish myself Game of Thrones style: "Shame! Shame! Shame!"
Lol. No problem :) Async stuff can be a pain. Am I good to close this issue?