Skip to content

Commit 29a244c

Browse files
authored
Merge pull request zendesk#421 from wpeterson/upgrade-faraday
Allow using Faraday 1.x release in gemspec
2 parents b5c5310 + dd600d6 commit 29a244c

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

lib/zendesk_api/middleware/request/etag_cache.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ def call(environment)
3030

3131
@app.call(environment).on_complete do |env|
3232
if cached && env[:status] == 304 # not modified
33+
# Handle differences in serialized env keys in Faraday < 1.0 and 1.0
34+
# See https://github.com/lostisland/faraday/pull/847
3335
env[:body] = cached[:body]
36+
env[:response_body] = cached[:response_body]
37+
3438
env[:response_headers].merge!(
3539
:etag => cached[:response_headers][:etag],
3640
:content_type => cached[:response_headers][:content_type],

lib/zendesk_api/middleware/response/raise_error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Response
66
class RaiseError < Faraday::Response::RaiseError
77
def call(env)
88
super
9-
rescue Faraday::Error::TimeoutError, Faraday::Error::ConnectionFailed => e
9+
rescue Faraday::TimeoutError, Faraday::ConnectionFailed => e
1010
raise Error::NetworkError.new(e, env)
1111
end
1212

spec/core/middleware/response/raise_error_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
context "with a failed connection" do
55
context "connection failed" do
66
before(:each) do
7-
stub_request(:any, /.*/).to_raise(Faraday::Error::ConnectionFailed)
7+
stub_request(:any, /.*/).to_raise(Faraday::ConnectionFailed)
88
end
99

1010
it "should raise NetworkError" do

zendesk_api.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
2626
s.required_ruby_version = ">= 2.3"
2727
s.required_rubygems_version = ">= 1.3.6"
2828

29-
s.add_runtime_dependency "faraday", ">= 0.9.0", "< 1.0.0"
29+
s.add_runtime_dependency "faraday", ">= 0.9.0", "< 2.0.0"
3030
s.add_runtime_dependency "hashie", ">= 3.5.2", "< 4.0.0"
3131
s.add_runtime_dependency "inflection"
3232
s.add_runtime_dependency "multipart-post", "~> 2.0"

0 commit comments

Comments
 (0)