Skip to content

Commit

Permalink
fix: json parser error for top level JSON values
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Apr 8, 2020
1 parent e5ba92a commit dafbc35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/pact/provider/test_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dafbc35

Please sign in to comment.