From 8dd163da91ab6c6b69dbc40f425574d63f26da3b Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 7 Jan 2016 13:14:49 +0100 Subject: [PATCH] Exclude method from json parse in before --- front-api/app.rb | 8 +++++--- front-api/helpers.rb | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/front-api/app.rb b/front-api/app.rb index 5dbe1f8..22b708f 100644 --- a/front-api/app.rb +++ b/front-api/app.rb @@ -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 diff --git a/front-api/helpers.rb b/front-api/helpers.rb index 6aba8f3..247eac7 100644 --- a/front-api/helpers.rb +++ b/front-api/helpers.rb @@ -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