From dafbc35e1111d0cdb77be9c9d55f2cedb97d41cf Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Wed, 8 Apr 2020 10:09:28 +1000 Subject: [PATCH] fix: json parser error for top level JSON values fixes: https://github.com/pact-foundation/pact-net/issues/237 --- lib/pact/provider/test_methods.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pact/provider/test_methods.rb b/lib/pact/provider/test_methods.rb index 92ddc004..243894aa 100644 --- a/lib/pact/provider/test_methods.rb +++ b/lib/pact/provider/test_methods.rb @@ -29,7 +29,9 @@ def replay_interaction interaction, request_customizer = nil def parse_body_from_response rack_response case rack_response.headers['Content-Type'] when /json/ - JSON.load(rack_response.body) + # For https://github.com/pact-foundation/pact-net/issues/237 + # Only required for the pact-ruby-standalone ¯\_(ツ)_/¯ + JSON.load("[#{rack_response.body}]").first else rack_response.body end