Skip to content

Commit

Permalink
fix: correct accept headers for requests to the pact broker
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jun 4, 2018
1 parent 4d93bf9 commit 415d9d5
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 19 deletions.
89 changes: 82 additions & 7 deletions doc/pacts/markdown/Pact Broker Client - Pact Broker.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ Pact Broker will respond with:
```json
{
"status": 400,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"errors": [
"an error message"
Expand All @@ -105,6 +108,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"matrix": [
{
Expand Down Expand Up @@ -166,6 +172,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
"deployable": true,
Expand Down Expand Up @@ -210,6 +219,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
"deployable": true,
Expand Down Expand Up @@ -254,6 +266,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
"deployable": true,
Expand Down Expand Up @@ -298,6 +313,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"matrix": [
{
Expand Down Expand Up @@ -331,6 +349,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
"deployable": true,
Expand Down Expand Up @@ -375,6 +396,9 @@ Pact Broker will respond with:
```json
{
"status": 400,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"errors": [
"an error message"
Expand All @@ -395,6 +419,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
"deployable": true,
Expand Down Expand Up @@ -433,14 +460,17 @@ Given **the pb:latest-tagged-version relation exists in the index resource**, up
"method": "get",
"path": "/",
"headers": {
"Accept": "application/json, application/hal+json"
"Accept": "application/hal+json, application/json"
}
}
```
Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"pb:latest-tagged-version": {
Expand All @@ -457,14 +487,17 @@ Given **the pb:latest-version relation exists in the index resource**, upon rece
"method": "get",
"path": "/",
"headers": {
"Accept": "application/json, application/hal+json"
"Accept": "application/hal+json, application/json"
}
}
```
Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"pb:latest-version": {
Expand Down Expand Up @@ -545,6 +578,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
"deployable": true,
Expand Down Expand Up @@ -588,6 +624,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"consumer": {
"name": "Condor"
Expand Down Expand Up @@ -791,6 +830,9 @@ Pact Broker will respond with:
```json
{
"status": 201,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"pb:latest-pact-version": {
Expand Down Expand Up @@ -826,6 +868,9 @@ Pact Broker will respond with:
```json
{
"status": 201,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"pb:latest-pact-version": {
Expand Down Expand Up @@ -895,6 +940,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"pb:latest-pact-version": {
Expand Down Expand Up @@ -930,6 +978,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"pb:latest-pact-version": {
Expand All @@ -956,7 +1007,10 @@ Given **the 'Pricing Service' already exists in the pact-broker**, upon receivin
Pact Broker will respond with:
```json
{
"status": 200
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
}
}
```
<a name="a_request_to_register_the_repository_URL_of_a_pacticipant_given_the_&#39;Pricing_Service&#39;_does_not_exist_in_the_pact-broker"></a>
Expand All @@ -976,7 +1030,10 @@ Given **the 'Pricing Service' does not exist in the pact-broker**, upon receivin
Pact Broker will respond with:
```json
{
"status": 201
"status": 201,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
}
}
```
<a name="a_request_to_retrieve_the_latest_&#39;production&#39;_version_of_Condor_given_&#39;Condor&#39;_exists_in_the_pact-broker_with_the_latest_tagged_&#39;production&#39;_version_1.2.3"></a>
Expand All @@ -986,14 +1043,17 @@ Given **'Condor' exists in the pact-broker with the latest tagged 'production' v
"method": "get",
"path": "/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-TAGGED-VERSION-Condor-production",
"headers": {
"Accept": "application/json, application/hal+json"
"Accept": "application/hal+json, application/json"
}
}
```
Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"number": "1.2.3",
"_links": {
Expand Down Expand Up @@ -1054,14 +1114,17 @@ Given **'Condor' exists in the pact-broker with the latest version 1.2.3**, upon
"method": "get",
"path": "/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-VERSION-Condor",
"headers": {
"Accept": "application/json, application/hal+json"
"Accept": "application/hal+json, application/json"
}
}
```
Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"number": "1.2.3",
"_links": {
Expand All @@ -1079,14 +1142,17 @@ Given **a pact between Condor and the Pricing Service exists for the production
"method": "get",
"path": "/pacts/provider/Pricing%20Service/consumer/Condor/latest/prod",
"headers": {
"Accept": "application/json, application/hal+json"
"Accept": "application/hal+json, application/json"
}
}
```
Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"consumer": {
"name": "Condor"
Expand Down Expand Up @@ -1115,6 +1181,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"self": {
Expand All @@ -1139,6 +1208,9 @@ Pact Broker will respond with:
```json
{
"status": 201,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"self": {
Expand All @@ -1163,6 +1235,9 @@ Pact Broker will respond with:
```json
{
"status": 201,
"headers": {
"Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
"self": {
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/client/base_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def initialize options
end

def default_request_headers
{'Accept' => 'application/json, application/hal+json'}
{'Accept' => 'application/hal+json, application/json'}
end

def default_get_headers
Expand Down
Loading

0 comments on commit 415d9d5

Please sign in to comment.