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

Faraday removes paths in base url #293

Closed
runemadsen opened this issue Aug 8, 2013 · 2 comments
Closed

Faraday removes paths in base url #293

runemadsen opened this issue Aug 8, 2013 · 2 comments

Comments

@runemadsen
Copy link

I'm having huge problems preserving the paths in my Faraday base url:

conn = Faraday.new(:url => 'http://example.com/api')
conn.get '/index' #=> GET http://example.com/index

Shouldn't this call http://example.com/api/index?

This article suggests so:
http://www.intridea.com/blog/2012/3/12/faraday-one-http-client-to-rule-them-all

Do I have to do anything to not let Faraday strip out the /api in my base url?

Also, I'm running Faraday 0.8.8 and Ruby 1.9.3p286. All docs say that Faraday shouldn't behave like this, but I'm seeing it on my mac, and on Linux virtual machines.

@mislav
Copy link
Contributor

mislav commented Aug 9, 2013

conn.get 'index'

(note the lack of leading slash)

If you use the leading slash, it means an absolute path, i.e. "discard whatever path is configured by the URL prefix of this connection".

@mislav mislav closed this as completed Aug 9, 2013
@runemadsen
Copy link
Author

Oh god, you're right. I was so sure I tried this a million times. Thanks a bunch.

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

2 participants