-
Notifications
You must be signed in to change notification settings - Fork 844
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
Need feature to append trailing slash #90
Comments
Hey, Have you tried escaping it? Using it like Could you give me a plunkr example of this not working? Thanks!!! |
Maybe you can check out: He's got it working. |
The thing is that with Django, we need the trailing slash. I had a read of #54 and I've actually worked around mine by doing something like Restangular.one("customer").post({...}).then(...). In Django, we can tell it to append the trailing slash. This works fine for GET, since what it does it just simply redirect, however it doesn't work out for POST because with a POST redirect, the data is lost. I forked your API and started doing some reading last night, I was thinking of trying to add a "alwaysAppendTrailingSlash" option or something of that sort. I think would help alot of Django users. I'm glad I came across your API because generally, from what I've seen on the web so far, people generally just end up building their own API for doing REST (instead of using $resource) because AngularJS doesn't ask your permission before stripping the trailing slash. Atleast with your API I could do the escaping easily. I'll try something and do a pull request. |
Hey, but with the Could you please provide me a http://plnkr.co/ example which shows this bug (How trailling slash is not send) so that I can reproduce this. If I can reproduce this, there's no need for sending a PR, I can take a look at fix it, but I think it should be working. Thanks again!! |
Here's my Plunk. It shows Firefox's behavior (use Firefox) http://www.plnkr.co/edit/yWt9124hXdyODCLKsXF0 |
Hey, it doesn't work on Firefox, but it does in chrome. It's pretty weird. |
Hey, would this work?
Because that can be easily set by just doing The problem is that this trailling slash removal is done in $resource. In order to fix this, I'd have to change the code and start using $http instead of $resource inside. |
So, I've completely checked this out. It doesn't work on Firefox at all, except for that exception that I pointed there. If that doesn't work, I'm going to create a ticket to change $resource to $http internally. That would fix these problems, as they're actually $resource bugs that I cannot fix without modifying Angular's code. Please let me know and I'll create this issue otherwise. Maybe I should've used $http instead of $resource from the begining |
Ok, weirdly enough I got some errors about Chrome not running the script because the MIME type was text and strict MIME type checking is enforced. As you said though, You may be better off using $http internally indeed, because $resource apparently only works nicely for API's that don't require the trailing slash. See this conversation on Stack Overflow (http://stackoverflow.com/questions/14533117/angular-trailing-slash-for-resource) and the issue opened in Angularjs repo (angular/angular.js#992). It would be awesome though if there was a feature like I mentioned to simply choose to always add the trailing slash, because adding the slash is really conditional. |
Closing this one. I'm gonna implement this on #97 |
Hey, Try version 0.8.7 as I've now ditched |
Will certainly test and let you know.
|
Hi, For those passing by, I can confirm that it works in FF with the code: (don't escape the / or you'll get a %5C at the end of the URL) |
For anyone still struggling with this (as it's still in the 1.4 branch): just add a "?" to the end of your string. From
to
|
This a great API, just wish it didn't suffer the same fate as AngularJS where Angular strips the trailing slash without asking permission :(
The text was updated successfully, but these errors were encountered: