Skip to content

Commit 2bab66c

Browse files
committed
fix: JSON load message document so that the Ruby objects are created properly
Fixes: pact-foundation/pact-standalone#65
1 parent 50779df commit 2bab66c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/pact/message/cli.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ class CLI < Thor
1414
long_desc <<-MSG, wrapping: false
1515
Update a pact with the given message, or create the pact if it does not exist.
1616
The MESSAGE_JSON may be in the legacy Ruby JSON format or the v2+ format.
17-
If MESSAGE_JSON is not provided or is '-', the content will be read from
17+
If MESSAGE_JSON is not provided or is '-', the content will be read from
1818
standard input.
1919
MSG
2020
def update(maybe_json = '-')
2121
require 'pact/message'
2222
require 'pact/message/consumer/write_pact'
2323

24-
message_json = JSON.parse(maybe_json == '-' ? $stdin.read : maybe_json)
24+
message_object = JSON.load(maybe_json == '-' ? $stdin.read : maybe_json)
2525

2626
pact_specification_version = Pact::SpecificationVersion.new(options.pact_specification_version)
27-
message_hash = Pact::Message.from_hash(message_json, { pact_specification_version: pact_specification_version })
27+
message_hash = Pact::Message.from_hash(message_object, { pact_specification_version: pact_specification_version })
2828
Pact::Message::Consumer::WritePact.call(message_hash, options.pact_dir, options.consumer, options.provider, options.pact_specification_version, :update)
2929
end
3030

0 commit comments

Comments
 (0)