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

View File

@@ -10,4 +10,8 @@ class Helper
def self.bam_to_euro(amount)
self.get_bam_to_euro_conversion_rate * amount
end
def self.do_not_parse_as_json
['/payment/confirmation']
end
end