This repository has been archived by the owner on Dec 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
113 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
Pacto Contracts describe the constraints we want to put on interactions between a consumer and a provider. It sets some expectations about the headers expected for both the request and response, the expected response status code. It also uses [json-schema](http://json-schema.org/) to define the allowable request body (if one should exist) and response body. | ||
|
||
```js | ||
{ | ||
``` | ||
The Request section comes first. In this case, we're just describing a simple get request that does not require any parameters or a request body. | ||
```js | ||
"request": { | ||
"headers": { | ||
``` | ||
A request must exactly match these headers for Pacto to believe the request matches the contract, unless `Pacto.configuration.strict_matchers` is false. | ||
```js | ||
"Accept": "application/vnd.github.beta+json", | ||
"Accept-Encoding": "gzip;q=1.0,deflate;q=0.6,identity;q=0.3" | ||
}, | ||
``` | ||
The `method` and `path` are required. The `path` may be an [rfc6570 URI template](http://tools.ietf.org/html/rfc6570) for more flexible matching. | ||
```js | ||
"http_method": "get", | ||
"path": "/repos/thoughtworks/pacto/readme" | ||
}, | ||
"response": { | ||
"headers": { | ||
"Content-Type": "application/json; charset=utf-8", | ||
"Status": "200 OK", | ||
"Cache-Control": "public, max-age=60, s-maxage=60", | ||
"Etag": "\"fc8e78b0a9694de66d47317768b20820\"", | ||
"Vary": "Accept, Accept-Encoding", | ||
"Access-Control-Allow-Credentials": "true", | ||
"Access-Control-Expose-Headers": "ETag, Link, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", | ||
"Access-Control-Allow-Origin": "*" | ||
}, | ||
"status": 200, | ||
"schema": { | ||
"$schema": "http://json-schema.org/draft-03/schema#", | ||
"description": "Generated from https://api.github.com/repos/thoughtworks/pacto/readme with shasum 3ae59164c6d9f84c0a81f21fb63e17b3b8ce6894", | ||
"type": "object", | ||
"required": true, | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"path": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"sha": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"size": { | ||
"type": "integer", | ||
"required": true | ||
}, | ||
"url": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"html_url": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"git_url": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"type": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"content": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"encoding": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"_links": { | ||
"type": "object", | ||
"required": true, | ||
"properties": { | ||
"self": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"git": { | ||
"type": "string", | ||
"required": true | ||
}, | ||
"html": { | ||
"type": "string", | ||
"required": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
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