Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$resource loses its URL's trailing slash #2589

Closed
temporaryaccount opened this issue May 6, 2013 · 9 comments
Closed

$resource loses its URL's trailing slash #2589

temporaryaccount opened this issue May 6, 2013 · 9 comments

Comments

@temporaryaccount
Copy link

When I define a $resource with a URL with trailing slash (e.g. '/ajax/') and then use it, Angular tries to fetch just '/ajax' at first, then it gets a HTTP redirect from Apache to '/ajax/', then it uses the correct URL.

@andredublin
Copy link

angular ngResource default behavior removes any trailing slashes off the end of a url, why not define the url w/o the trailing slash and prevent apache .htaccess from redirecting?

@temporaryaccount
Copy link
Author

@andredublin
Thank you for response. In fact, there is no .htaccess there, there is a directory called "ajax" where index.php file is located, I can use "ajax/index.php" but considering that index.php is the default execution handler when it exists, I would prefer just "ajax/", this is a valid URL, isn't it? Why should ngResource remove the trailing slash?

@btford btford closed this as completed Aug 24, 2013
@btford
Copy link
Contributor

btford commented Aug 24, 2013

As part of our effort to clean out old issues, this issue is being automatically closed since it has been inactivite for over two months.

Please try the newest versions of Angular (1.0.8 and 1.2.0-rc.1), and if the issue persists, comment below so we can discuss it.

Thanks!

@jarmani
Copy link

jarmani commented Sep 11, 2013

Still the case in 1.2.0-rc.2 and master https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js#L374

This behavior is really annoying as some API around require the ending slash.
What's the benefit of removing it ?

@jtangelder
Copy link
Contributor

I'm having the same issue. Removing the line (now at https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js#L388) fixes this problem. Why not make it an option?

@ghost
Copy link

ghost commented Mar 6, 2014

We just ran into this as well. Our API is built on Django and requires slashes. Please reopen this! Thanks!

@caitp
Copy link
Contributor

caitp commented Mar 6, 2014

I believe #5560 is related to this, and possibly fixes it

@andredublin
Copy link

@caitp 👍 Thats a great feature option

@linclark
Copy link
Contributor

As caitp points out, this looks like the same issue as #5560. Since folks are working on a solution there, closing this as a duplicate.

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

No branches or pull requests

7 participants