|
13 | 13 | stub.get('proxy-error') { [407, { 'X-Reason' => 'because' }, 'keep looking'] } |
14 | 14 | stub.get('request-timeout') { [408, { 'X-Reason' => 'because' }, 'keep looking'] } |
15 | 15 | stub.get('conflict') { [409, { 'X-Reason' => 'because' }, 'keep looking'] } |
16 | | - stub.get('unprocessable-entity') { [422, { 'X-Reason' => 'because' }, 'keep looking'] } |
| 16 | + stub.get('unprocessable-content') { [422, { 'X-Reason' => 'because' }, 'keep looking'] } |
17 | 17 | stub.get('too-many-requests') { [429, { 'X-Reason' => 'because' }, 'keep looking'] } |
18 | 18 | stub.get('4xx') { [499, { 'X-Reason' => 'because' }, 'keep looking'] } |
19 | 19 | stub.get('nil-status') { [nil, { 'X-Reason' => 'nil' }, 'fail'] } |
|
103 | 103 | end |
104 | 104 | end |
105 | 105 |
|
106 | | - it 'raises Faraday::UnprocessableEntityError for 422 responses' do |
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 for GET http:/unprocessable-entity') |
| 106 | + it 'raises legacy Faraday::UnprocessableEntityError for 422 responses' do |
| 107 | + expect { conn.get('unprocessable-content') }.to raise_error(Faraday::UnprocessableEntityError) do |ex| |
| 108 | + expect(ex.message).to eq('the server responded with status 422 for GET http:/unprocessable-content') |
| 109 | + expect(ex.response[:headers]['X-Reason']).to eq('because') |
| 110 | + expect(ex.response[:status]).to eq(422) |
| 111 | + expect(ex.response_status).to eq(422) |
| 112 | + expect(ex.response_body).to eq('keep looking') |
| 113 | + expect(ex.response_headers['X-Reason']).to eq('because') |
| 114 | + end |
| 115 | + end |
| 116 | + |
| 117 | + it 'raises Faraday::UnprocessableContentError for 422 responses' do |
| 118 | + expect { conn.get('unprocessable-content') }.to raise_error(Faraday::UnprocessableContentError) do |ex| |
| 119 | + expect(ex.message).to eq('the server responded with status 422 for GET http:/unprocessable-content') |
109 | 120 | expect(ex.response[:headers]['X-Reason']).to eq('because') |
110 | 121 | expect(ex.response[:status]).to eq(422) |
111 | 122 | expect(ex.response_status).to eq(422) |
|
0 commit comments