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)
29
29
when 409
30
30
raise Errors ::Conflict , env
31
31
when 400 ..499
32
- # some other error
32
+ raise Errors :: ClientError , env
33
33
when 500 ..599
34
34
raise Errors ::ServerError , env
35
35
else
Original file line number Diff line number Diff line change @@ -56,4 +56,17 @@ def test_server_responding_with_404_status_meta
56
56
end
57
57
end
58
58
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
59
72
end
You can’t perform that action at this time.
0 commit comments