Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Problematic deletion of trailing slashes in urls #70

Closed
fpauser opened this issue Mar 7, 2016 · 7 comments
Closed

Problematic deletion of trailing slashes in urls #70

fpauser opened this issue Mar 7, 2016 · 7 comments

Comments

@fpauser
Copy link

fpauser commented Mar 7, 2016

See https://github.com/ember-cli/ember-ajax/blob/master/addon/ajax-request.js#L236

Why are trailing slashes removed?
Right now to keep the trailing slashes in pathes we must convert paths to absolute urls, which feels just not right.

@alexlafroscia
Copy link
Collaborator

Currently, that's just done for convenience on our part. You have an API that requires a slash at the end?

@badazz91
Copy link

badazz91 commented Mar 8, 2016

Our custom API reacts somewhat opinionated, when forgetting the trailing slashes, resolving in a 404 error.

@topaxi
Copy link
Contributor

topaxi commented Mar 27, 2016

I just ran into this, I'm encountering an API which does a redirect from non-slashed endpoint to an endpoint with an slash and messes up the response.

@alexlafroscia
Copy link
Collaborator

Sorry about that; there's a PR open that needs some tweaking before we can fix this. I will try to clean it up myself this week.

@kaungst
Copy link

kaungst commented Apr 22, 2016

One workaround I found was to add an additional trailing slash at the end.
e.g. http://www.random.com/stuff//

alexlafroscia added a commit to alexlafroscia/ember-ajax that referenced this issue Apr 23, 2016
The old way of building a URL was too brittle and didn't cover a lot of
the different cases that could take place, in different combinations of
the host, namespace, and segment having or not having slashes included.

The new approach implemented here handles the various cases correctly,
and ensures that we do not remove a trailing slash if one was provided.

Closes ember-cli#70
alexlafroscia added a commit to alexlafroscia/ember-ajax that referenced this issue Apr 23, 2016
The old way of building a URL was too brittle and didn't cover a lot of
the different cases that could take place, in different combinations of
the host, namespace, and segment having or not having slashes included.

The new approach implemented here handles the various cases correctly,
and ensures that we do not remove a trailing slash if one was provided.

Closes ember-cli#70
alexlafroscia added a commit to alexlafroscia/ember-ajax that referenced this issue Apr 23, 2016
The old way of building a URL was too brittle and didn't cover a lot of
the different cases that could take place, in different combinations of
the host, namespace, and segment having or not having slashes included.

The new approach implemented here handles the various cases correctly,
and ensures that we do not remove a trailing slash if one was provided.

Closes ember-cli#70
alexlafroscia added a commit to alexlafroscia/ember-ajax that referenced this issue May 30, 2016
The old way of building a URL was too brittle and didn't cover a lot of
the different cases that could take place, in different combinations of
the host, namespace, and segment having or not having slashes included.

The new approach implemented here handles the various cases correctly,
and ensures that we do not remove a trailing slash if one was provided.

Closes ember-cli#70
@jamesarosen
Copy link

For posterity: we just fixed this in our app by upgrading to 2.4.1 :)

@alexlafroscia
Copy link
Collaborator

alexlafroscia commented Aug 5, 2016

@jamesarosen excellent! Glad to hear it's working for you

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

No branches or pull requests

6 participants