From e915d7f452dd67ea086d2e5eb71ac857faec1388 Mon Sep 17 00:00:00 2001 From: Grant McLendon Date: Mon, 16 May 2016 11:09:17 +0200 Subject: [PATCH] Scope JSON to global ruby, prevents conflicts with Sinatra::Json library --- .../processing/swagger-response-processor.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sinatra/swagger-exposer/processing/swagger-response-processor.rb b/lib/sinatra/swagger-exposer/processing/swagger-response-processor.rb index 713812c..36ef2da 100644 --- a/lib/sinatra/swagger-exposer/processing/swagger-response-processor.rb +++ b/lib/sinatra/swagger-exposer/processing/swagger-response-processor.rb @@ -32,8 +32,8 @@ def useful? def validate_response(response_body) parsed_response_body = nil begin - parsed_response_body = JSON.parse(response_body) - rescue JSON::ParserError => e + parsed_response_body = ::JSON.parse(response_body) + rescue ::JSON::ParserError => e raise SwaggerInvalidException.new("Response is not a valid json [#{response_body}]") end if @processor @@ -44,4 +44,4 @@ def validate_response(response_body) end end end -end \ No newline at end of file +end