From a217471dc69cfd56604ae79f40de71086f7f5561 Mon Sep 17 00:00:00 2001 From: Mattia Date: Sun, 12 May 2019 10:18:27 +0100 Subject: [PATCH] Explain Absolute path behaviour in README (#977) Updates the REAME to explain how the absolute path overrides the one provided while initialising the connection. Fixes #976 --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0711bf549..be73e8985 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,11 @@ stack and default adapter (see [Faraday::RackBuilder#initialize](https://github. A more flexible way to use Faraday is to start with a Connection object. If you want to keep the same defaults, you can use this syntax: ```ruby -conn = Faraday.new(:url => 'http://www.example.com') -response = conn.get '/users' # GET http://www.example.com/users' +conn = Faraday.new(:url => 'http://www.example.com/api') +response = conn.get 'users' # GET http://www.example.com/api/users' + +# You can override the path from the connection initializer by using an absolute path +response = conn.get '/users' # GET http://www.example.com/users' ``` Connections can also take an options hash as a parameter or be configured by using a block. Checkout the section called [Advanced middleware usage](#advanced-middleware-usage) for more details about how to use this block for configurations.