Skip to content

Instantly share code, notes, and snippets.

@thetrav
Last active December 27, 2015 20:09
Show Gist options
  • Save thetrav/7382137 to your computer and use it in GitHub Desktop.
Save thetrav/7382137 to your computer and use it in GitHub Desktop.
sample pact matchers
{
"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