Skip to content

Commit

Permalink
Do not set the adapter on faraday prior the request (#149)
Browse files Browse the repository at this point in the history
* Do not set the adapter on faraday prior the request

Related to lostisland/faraday#685 and fixes #148

* adjusting farady middleware patch even more, since also the response configuration must come before any adapter is set

* remove .idea, however this slipped through, sorry
  • Loading branch information
EugenMayer authored and johnhamelink committed Jul 28, 2017
1 parent 7502e06 commit 2709c0d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/diplomat/rest_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,14 @@ def start_connection(api_connection = nil)

def build_connection(api_connection, raise_error = false)
api_connection || Faraday.new(Diplomat.configuration.url, Diplomat.configuration.options) do |faraday|
faraday.adapter Faraday.default_adapter
faraday.request :url_encoded
faraday.response :raise_error unless raise_error

Diplomat.configuration.middleware.each do |middleware|
faraday.use middleware
end

faraday.request :url_encoded
faraday.response :raise_error unless raise_error

faraday.adapter Faraday.default_adapter
end
end

Expand Down

0 comments on commit 2709c0d

Please sign in to comment.