lib/her/middleware/json_api_parser.rb in her-1.0.1 vs lib/her/middleware/json_api_parser.rb in her-1.0.2
- old
+ new
@@ -1,10 +1,11 @@
module Her
module Middleware
# This middleware expects the resource/collection data to be contained in the `data`
# key of the JSON object
class JsonApiParser < ParseJSON
+
# Parse the response body
#
# @param [String] body The response body
# @return [Mixed] the parsed response
# @private
@@ -23,14 +24,14 @@
#
# @param [Hash] env The response environment
# @private
def on_complete(env)
env[:body] = case env[:status]
- when 204, 304
- parse('{}')
- else
- parse(env[:body])
- end
+ when 204, 304
+ parse('{}')
+ else
+ parse(env[:body])
+ end
end
end
end
end