node-consumer-pact-validation
Version:
A consumer pact generator written for pure nodeJS
36 lines (35 loc) • 862 B
JSON
{
"match": true,
"comment": "Requests match with regex",
"expected" : {
"method": "POST",
"path": "/",
"query": "",
"headers": {"Content-Type": "application/json"},
"matchingRules": {
"$.body.alligator.name": {"match": "regex", "regex": "\\w+"},
"$.body.alligator.favouriteColours[0]": {"match": "regex", "regex": "red|blue"},
"$.body.alligator.favouriteColours[1]": {"match": "regex", "regex": "red|blue"}
},
"body": {
"alligator":{
"name": "Mary",
"feet": 4,
"favouriteColours": ["red","blue"]
}
}
},
"actual": {
"method": "POST",
"path": "/",
"query": "",
"headers": {"Content-Type": "application/json"},
"body": {
"alligator":{
"feet": 4,
"name": "Harry",
"favouriteColours": ["blue", "red"]
}
}
}
}