Last active
December 27, 2015 20:09
-
-
Save thetrav/7382137 to your computer and use it in GitHub Desktop.
sample pact matchers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"provider": { | |
"name": "Animal Service" | |
}, | |
"consumer": { | |
"name": "Zoo App" | |
}, | |
"interactions": [ | |
{ | |
"description": "a request for animals", | |
"request": { | |
"method": "get", | |
"path": "/animals" | |
}, | |
"request_matchers": { | |
"path": "/animals/[0-9]+", //matches any numeric ID path | |
"body": { | |
"allowExtra": true, | |
"content": { | |
"propList": { | |
"allowExtra": false, | |
"content": [ {"allowExtra": true} ] // prop list will have exactly one object in it and that item can contain any keys | |
} | |
} | |
} | |
}, | |
"response": { | |
"status": 200, | |
"headers": { | |
"Content-Type": "application/json" | |
}, | |
"body": { | |
"alligators": [ | |
{ | |
"name": "Bob" | |
} | |
] | |
} | |
}, | |
"reponseMatchers": { | |
"status": "2\d\d", | |
"body": { | |
} | |
}, | |
"providerState": "there are alligators" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment