rack-autocrud 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rack/autocrud.rb +2 -2
- metadata +1 -1
data/lib/rack/autocrud.rb
CHANGED
@@ -83,7 +83,7 @@ module Rack
|
|
83
83
|
obj = model.create(JSON.parse(request.body.read))
|
84
84
|
halt [402, '{ "error": "Failed to save ' + endpoint + '" }'] unless obj && obj.saved?
|
85
85
|
rescue JSON::ParserError
|
86
|
-
|
86
|
+
halt [ 400, { 'error' => 'Invalid JSON in request body.', 'details' => $! }.to_json ]
|
87
87
|
end
|
88
88
|
|
89
89
|
# Call the post-create hook
|
@@ -128,7 +128,7 @@ module Rack
|
|
128
128
|
saved = model.update(JSON.parse(request.body.read))
|
129
129
|
halt [403, 'Access Denied'] unless saved
|
130
130
|
rescue JSON::ParserError
|
131
|
-
|
131
|
+
halt [ 400, { 'error' => 'Invalid JSON in request body.', 'details' => $! }.to_json ]
|
132
132
|
end
|
133
133
|
|
134
134
|
# Call the post-update hook
|