Skip to content
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

Don't strip trailing slashes #22

Open
pnomolos opened this issue Mar 11, 2016 · 2 comments
Open

Don't strip trailing slashes #22

pnomolos opened this issue Mar 11, 2016 · 2 comments

Comments

@pnomolos
Copy link

I'm working against a third-party API that barfs if the URL doesn't have a trailing slash on it. I see that this is handled by EndpointResolver (https://github.com/digitalocean/resource_kit/blob/master/lib/resource_kit/endpoint_resolver.rb#L30) and am wondering if it's a necessity or if a patch to leave a trailing slash if it exists it would be accepted?

@bmiles
Copy link

bmiles commented Sep 18, 2016

This is driving me nuts as well because I'm trying to wrap an API that looks like www.example.com/:organization_id/projects.json so I need to be able to set www.example.com/:organization_id as the base URL on the creation of the Client and just have things like "projects.json" as the path on the resource.

The problem is my connection url keeps getting stripped down to www.example.com when the Client gets created. 😠

@kyrylo
Copy link

kyrylo commented Sep 4, 2017

There's another related issue. If your base API URL is like http://example.com/api, and your resources are like http://example.com/api/v1/things, then you can't define actions like this: GET v1/things because EndpointResolver inserts a leading slash /v1/things, which makes Faraday neglect the /api part of the API URL (described in lostisland/faraday#293).

I think this needs to be solved in this gem. A workaround is to define your base URL like this: http://example.com and define actions like this: GET /api/v1/things.

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

No branches or pull requests

3 participants