Exclude method from json parse in before
This commit is contained in:
@@ -37,9 +37,11 @@ before do
|
|||||||
'Access-Control-Expose-Headers' => 'X-Total-Count',
|
'Access-Control-Expose-Headers' => 'X-Total-Count',
|
||||||
'Access-Control-Allow-Credentials' => 'true'
|
'Access-Control-Allow-Credentials' => 'true'
|
||||||
|
|
||||||
request.body.rewind
|
unless Helper::do_not_parse_as_json.include? env['PATH_INFO']
|
||||||
json_string = request.body.read
|
request.body.rewind
|
||||||
@json_params = JSON.parse json_string if json_string.length > 1
|
json_string = request.body.reads
|
||||||
|
@json_params = JSON.parse json_string if json_string.length > 1
|
||||||
|
end
|
||||||
|
|
||||||
if request.request_method == 'OPTIONS'
|
if request.request_method == 'OPTIONS'
|
||||||
halt 200
|
halt 200
|
||||||
|
|||||||
@@ -10,4 +10,8 @@ class Helper
|
|||||||
def self.bam_to_euro(amount)
|
def self.bam_to_euro(amount)
|
||||||
self.get_bam_to_euro_conversion_rate * amount
|
self.get_bam_to_euro_conversion_rate * amount
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.do_not_parse_as_json
|
||||||
|
['/payment/confirmation']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user