Skip to content

Commit

Permalink
chore: parse yaml contracts for pf
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Oct 15, 2021
1 parent a7d6925 commit 62e0ab2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/pact_broker/api/resources/publish_contracts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def schema
def decode_and_parse_content(contract)
contract["decodedContent"] = Base64.strict_decode64(contract["content"]) rescue nil
if contract["decodedContent"]
contract["decodedParsedContent"] = PactBroker::Pacts::Parse.call(contract["decodedContent"]) rescue nil
if contract["contentType"]&.include?("json")
contract["decodedParsedContent"] = PactBroker::Pacts::Parse.call(contract["decodedContent"]) rescue nil
elsif contract["contentType"]&.include?("yml")
contract["decodedParsedContent"] = YAML.safe_load(contract["decodedContent"], [Time, Date, DateTime]) rescue nil
end
end
end

Expand Down

0 comments on commit 62e0ab2

Please sign in to comment.