Exclude method from json parse in before

This commit is contained in:
Adam
2016-01-07 13:14:49 +01:00
parent ea1c760e85
commit 8dd163da91
2 changed files with 9 additions and 3 deletions

View File

@@ -37,9 +37,11 @@ before do
'Access-Control-Expose-Headers' => 'X-Total-Count',
'Access-Control-Allow-Credentials' => 'true'
request.body.rewind
json_string = request.body.read
@json_params = JSON.parse json_string if json_string.length > 1
unless Helper::do_not_parse_as_json.include? env['PATH_INFO']
request.body.rewind
json_string = request.body.reads
@json_params = JSON.parse json_string if json_string.length > 1
end
if request.request_method == 'OPTIONS'
halt 200