faraday 2.7.8 → 2.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc827983d5e95a84b94d70dc8d06579e55c782037d238f39960a8017c15170da
4
- data.tar.gz: cf3f9bc02d1781ca10e38056726f7d50dc410936c2d6ac0c666aedbdce3fa555
3
+ metadata.gz: 83ff6180688a921d25648a542c61ed892a45073f0847c7596e3758c3e0840736
4
+ data.tar.gz: 074e9f49f201d6ac82317775e5afcbacebdb1fa82314e31945fb2ca7f2382640
5
5
  SHA512:
6
- metadata.gz: 511c0853544f2a044d1ebe1f4b491742b029113688208ec4ba5a96c992e1d8422c7d0188f7923d2a9a778985f227dd91d3f740b3752caab430a27c82443a81ce
7
- data.tar.gz: d9f685f4cbe3a91afd41e4490fee3171605fafdb28211fca0d3daa29deaea75acac80f126754591e9bfd75af299d7acc37f8b9793107faedebdf8845f9d125c5
6
+ metadata.gz: a54d949779bac334681a0d860f6ada434bb48ff9497b2388fb75dd3e1686b9b4fe0fd203d79e7fb5c88dfa16a824c24feee29595914ed9ecdeff3119c4c1e7f3
7
+ data.tar.gz: 70d759d4b358898746df53e29e9b2cb4d05466bc158f6d433e26fde3471123295a46c3f53da3214bfe992680e28db5cdd5c418c1a1fc3e05b45417bd09436036
@@ -275,7 +275,7 @@ module Faraday
275
275
 
276
276
  unless stub
277
277
  raise Stubs::NotFound, "no stubbed request for #{env[:method]} " \
278
- "#{env[:url]} #{env[:body]}"
278
+ "#{env[:url]} #{env[:body]} #{env[:headers]}"
279
279
  end
280
280
 
281
281
  block_arity = stub.block.arity
data/lib/faraday/error.rb CHANGED
@@ -112,6 +112,10 @@ module Faraday
112
112
  class ProxyAuthError < ClientError
113
113
  end
114
114
 
115
+ # Raised by Faraday::Response::RaiseError in case of a 408 response.
116
+ class RequestTimeoutError < ClientError
117
+ end
118
+
115
119
  # Raised by Faraday::Response::RaiseError in case of a 409 response.
116
120
  class ConflictError < ClientError
117
121
  end
@@ -24,6 +24,8 @@ module Faraday
24
24
  # mimic the behavior that we get with proxy requests with HTTPS
25
25
  msg = %(407 "Proxy Authentication Required")
26
26
  raise Faraday::ProxyAuthError.new(msg, response_values(env))
27
+ when 408
28
+ raise Faraday::RequestTimeoutError, response_values(env)
27
29
  when 409
28
30
  raise Faraday::ConflictError, response_values(env)
29
31
  when 422
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Faraday
4
- VERSION = '2.7.8'
4
+ VERSION = '2.7.9'
5
5
  end
@@ -11,6 +11,7 @@ RSpec.describe Faraday::Response::RaiseError do
11
11
  stub.get('forbidden') { [403, { 'X-Reason' => 'because' }, 'keep looking'] }
12
12
  stub.get('not-found') { [404, { 'X-Reason' => 'because' }, 'keep looking'] }
13
13
  stub.get('proxy-error') { [407, { 'X-Reason' => 'because' }, 'keep looking'] }
14
+ stub.get('request-timeout') { [408, { 'X-Reason' => 'because' }, 'keep looking'] }
14
15
  stub.get('conflict') { [409, { 'X-Reason' => 'because' }, 'keep looking'] }
15
16
  stub.get('unprocessable-entity') { [422, { 'X-Reason' => 'because' }, 'keep looking'] }
16
17
  stub.get('4xx') { [499, { 'X-Reason' => 'because' }, 'keep looking'] }
@@ -79,6 +80,17 @@ RSpec.describe Faraday::Response::RaiseError do
79
80
  end
80
81
  end
81
82
 
83
+ it 'raises Faraday::RequestTimeoutError for 408 responses' do
84
+ expect { conn.get('request-timeout') }.to raise_error(Faraday::RequestTimeoutError) do |ex|
85
+ expect(ex.message).to eq('the server responded with status 408')
86
+ expect(ex.response[:headers]['X-Reason']).to eq('because')
87
+ expect(ex.response[:status]).to eq(408)
88
+ expect(ex.response_status).to eq(408)
89
+ expect(ex.response_body).to eq('keep looking')
90
+ expect(ex.response_headers['X-Reason']).to eq('because')
91
+ end
92
+ end
93
+
82
94
  it 'raises Faraday::ConflictError for 409 responses' do
83
95
  expect { conn.get('conflict') }.to raise_error(Faraday::ConflictError) do |ex|
84
96
  expect(ex.message).to eq('the server responded with status 409')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.8
4
+ version: 2.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@technoweenie"
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-06-28 00:00:00.000000000 Z
13
+ date: 2023-06-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday-net_http
@@ -131,7 +131,7 @@ licenses:
131
131
  - MIT
132
132
  metadata:
133
133
  homepage_uri: https://lostisland.github.io/faraday
134
- changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.7.8
134
+ changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.7.9
135
135
  source_code_uri: https://github.com/lostisland/faraday
136
136
  bug_tracker_uri: https://github.com/lostisland/faraday/issues
137
137
  post_install_message: