File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
lib/json_api_client/middleware Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def handle_status(code, env)
2929 when 409
3030 raise Errors ::Conflict , env
3131 when 400 ..499
32- # some other error
32+ raise Errors :: ClientError , env
3333 when 500 ..599
3434 raise Errors ::ServerError , env
3535 else
Original file line number Diff line number Diff line change @@ -56,4 +56,17 @@ def test_server_responding_with_404_status_meta
5656 end
5757 end
5858
59+ def test_server_responding_with_408_status
60+ stub_request ( :get , "http://example.com/users/1" )
61+ . to_return ( headers : { content_type : "application/vnd.api+json" } , body : {
62+ meta : {
63+ status : 408 ,
64+ message : "Request timeout"
65+ }
66+ } . to_json )
67+
68+ assert_raises JsonApiClient ::Errors ::ClientError do
69+ User . find ( 1 )
70+ end
71+ end
5972end
You can’t perform that action at this time.
0 commit comments