|
28 | 28 |
|
29 | 29 | it 'raises Faraday::BadRequestError for 400 responses' do |
30 | 30 | expect { conn.get('bad-request') }.to raise_error(Faraday::BadRequestError) do |ex| |
31 | | - expect(ex.message).to eq('the server responded with status 400') |
| 31 | + expect(ex.message).to eq('the server responded with status 400 for GET http:/bad-request') |
32 | 32 | expect(ex.response[:headers]['X-Reason']).to eq('because') |
33 | 33 | expect(ex.response[:status]).to eq(400) |
34 | 34 | expect(ex.response_status).to eq(400) |
|
39 | 39 |
|
40 | 40 | it 'raises Faraday::UnauthorizedError for 401 responses' do |
41 | 41 | expect { conn.get('unauthorized') }.to raise_error(Faraday::UnauthorizedError) do |ex| |
42 | | - expect(ex.message).to eq('the server responded with status 401') |
| 42 | + expect(ex.message).to eq('the server responded with status 401 for GET http:/unauthorized') |
43 | 43 | expect(ex.response[:headers]['X-Reason']).to eq('because') |
44 | 44 | expect(ex.response[:status]).to eq(401) |
45 | 45 | expect(ex.response_status).to eq(401) |
|
50 | 50 |
|
51 | 51 | it 'raises Faraday::ForbiddenError for 403 responses' do |
52 | 52 | expect { conn.get('forbidden') }.to raise_error(Faraday::ForbiddenError) do |ex| |
53 | | - expect(ex.message).to eq('the server responded with status 403') |
| 53 | + expect(ex.message).to eq('the server responded with status 403 for GET http:/forbidden') |
54 | 54 | expect(ex.response[:headers]['X-Reason']).to eq('because') |
55 | 55 | expect(ex.response[:status]).to eq(403) |
56 | 56 | expect(ex.response_status).to eq(403) |
|
61 | 61 |
|
62 | 62 | it 'raises Faraday::ResourceNotFound for 404 responses' do |
63 | 63 | expect { conn.get('not-found') }.to raise_error(Faraday::ResourceNotFound) do |ex| |
64 | | - expect(ex.message).to eq('the server responded with status 404') |
| 64 | + expect(ex.message).to eq('the server responded with status 404 for GET http:/not-found') |
65 | 65 | expect(ex.response[:headers]['X-Reason']).to eq('because') |
66 | 66 | expect(ex.response[:status]).to eq(404) |
67 | 67 | expect(ex.response_status).to eq(404) |
|
83 | 83 |
|
84 | 84 | it 'raises Faraday::RequestTimeoutError for 408 responses' do |
85 | 85 | expect { conn.get('request-timeout') }.to raise_error(Faraday::RequestTimeoutError) do |ex| |
86 | | - expect(ex.message).to eq('the server responded with status 408') |
| 86 | + expect(ex.message).to eq('the server responded with status 408 for GET http:/request-timeout') |
87 | 87 | expect(ex.response[:headers]['X-Reason']).to eq('because') |
88 | 88 | expect(ex.response[:status]).to eq(408) |
89 | 89 | expect(ex.response_status).to eq(408) |
|
94 | 94 |
|
95 | 95 | it 'raises Faraday::ConflictError for 409 responses' do |
96 | 96 | expect { conn.get('conflict') }.to raise_error(Faraday::ConflictError) do |ex| |
97 | | - expect(ex.message).to eq('the server responded with status 409') |
| 97 | + expect(ex.message).to eq('the server responded with status 409 for GET http:/conflict') |
98 | 98 | expect(ex.response[:headers]['X-Reason']).to eq('because') |
99 | 99 | expect(ex.response[:status]).to eq(409) |
100 | 100 | expect(ex.response_status).to eq(409) |
|
105 | 105 |
|
106 | 106 | it 'raises Faraday::UnprocessableEntityError for 422 responses' do |
107 | 107 | expect { conn.get('unprocessable-entity') }.to raise_error(Faraday::UnprocessableEntityError) do |ex| |
108 | | - expect(ex.message).to eq('the server responded with status 422') |
| 108 | + expect(ex.message).to eq('the server responded with status 422 for GET http:/unprocessable-entity') |
109 | 109 | expect(ex.response[:headers]['X-Reason']).to eq('because') |
110 | 110 | expect(ex.response[:status]).to eq(422) |
111 | 111 | expect(ex.response_status).to eq(422) |
|
116 | 116 |
|
117 | 117 | it 'raises Faraday::TooManyRequestsError for 429 responses' do |
118 | 118 | expect { conn.get('too-many-requests') }.to raise_error(Faraday::TooManyRequestsError) do |ex| |
119 | | - expect(ex.message).to eq('the server responded with status 429') |
| 119 | + expect(ex.message).to eq('the server responded with status 429 for GET http:/too-many-requests') |
120 | 120 | expect(ex.response[:headers]['X-Reason']).to eq('because') |
121 | 121 | expect(ex.response[:status]).to eq(429) |
122 | 122 | expect(ex.response_status).to eq(429) |
|
138 | 138 |
|
139 | 139 | it 'raises Faraday::ClientError for other 4xx responses' do |
140 | 140 | expect { conn.get('4xx') }.to raise_error(Faraday::ClientError) do |ex| |
141 | | - expect(ex.message).to eq('the server responded with status 499') |
| 141 | + expect(ex.message).to eq('the server responded with status 499 for GET http:/4xx') |
142 | 142 | expect(ex.response[:headers]['X-Reason']).to eq('because') |
143 | 143 | expect(ex.response[:status]).to eq(499) |
144 | 144 | expect(ex.response_status).to eq(499) |
|
149 | 149 |
|
150 | 150 | it 'raises Faraday::ServerError for 500 responses' do |
151 | 151 | expect { conn.get('server-error') }.to raise_error(Faraday::ServerError) do |ex| |
152 | | - expect(ex.message).to eq('the server responded with status 500') |
| 152 | + expect(ex.message).to eq('the server responded with status 500 for GET http:/server-error') |
153 | 153 | expect(ex.response[:headers]['X-Error']).to eq('bailout') |
154 | 154 | expect(ex.response[:status]).to eq(500) |
155 | 155 | expect(ex.response_status).to eq(500) |
|
0 commit comments