File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
lib/json_api_client/middleware Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ def handle_status(code, env)
2828 raise Errors ::NotFound , env [ :url ]
2929 when 409
3030 raise Errors ::Conflict , env
31+ when 422
32+ # Allow to proceed as resource errors will be populated
3133 when 400 ..499
3234 raise Errors ::ClientError , env
3335 when 500 ..599
Original file line number Diff line number Diff line change @@ -69,4 +69,16 @@ def test_server_responding_with_408_status
6969 User . find ( 1 )
7070 end
7171 end
72+
73+ def test_server_responding_with_422_status
74+ stub_request ( :get , "http://example.com/users/1" )
75+ . to_return ( headers : { content_type : "application/vnd.api+json" } , body : {
76+ meta : {
77+ status : 422
78+ }
79+ } . to_json )
80+
81+ # We want to test that this response does not raise an error
82+ User . find ( 1 )
83+ end
7284end
You can’t perform that action at this time.
0 commit comments