diff --git a/doc/pacts/markdown/Pact Broker Client - Pact Broker.md b/doc/pacts/markdown/Pact Broker Client - Pact Broker.md
index 1c96e386..b5c47fde 100644
--- a/doc/pacts/markdown/Pact Broker Client - Pact Broker.md
+++ b/doc/pacts/markdown/Pact Broker Client - Pact Broker.md
@@ -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"
@@ -105,6 +108,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
+ "headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
+ },
"body": {
"matrix": [
{
@@ -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,
@@ -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,
@@ -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,
@@ -298,6 +313,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
+ "headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
+ },
"body": {
"matrix": [
{
@@ -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,
@@ -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"
@@ -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,
@@ -433,7 +460,7 @@ 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"
}
}
```
@@ -441,6 +468,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
+ "headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
+ },
"body": {
"_links": {
"pb:latest-tagged-version": {
@@ -457,7 +487,7 @@ 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"
}
}
```
@@ -465,6 +495,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
+ "headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
+ },
"body": {
"_links": {
"pb:latest-version": {
@@ -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,
@@ -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"
@@ -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": {
@@ -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": {
@@ -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": {
@@ -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": {
@@ -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"
+ }
}
```
@@ -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"
+ }
}
```
@@ -986,7 +1043,7 @@ 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"
}
}
```
@@ -994,6 +1051,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
+ "headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
+ },
"body": {
"number": "1.2.3",
"_links": {
@@ -1054,7 +1114,7 @@ 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"
}
}
```
@@ -1062,6 +1122,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
+ "headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
+ },
"body": {
"number": "1.2.3",
"_links": {
@@ -1079,7 +1142,7 @@ 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"
}
}
```
@@ -1087,6 +1150,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
+ "headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
+ },
"body": {
"consumer": {
"name": "Condor"
@@ -1115,6 +1181,9 @@ Pact Broker will respond with:
```json
{
"status": 200,
+ "headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
+ },
"body": {
"_links": {
"self": {
@@ -1139,6 +1208,9 @@ Pact Broker will respond with:
```json
{
"status": 201,
+ "headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
+ },
"body": {
"_links": {
"self": {
@@ -1163,6 +1235,9 @@ Pact Broker will respond with:
```json
{
"status": 201,
+ "headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
+ },
"body": {
"_links": {
"self": {
diff --git a/lib/pact_broker/client/base_client.rb b/lib/pact_broker/client/base_client.rb
index 55c6d671..e5011b07 100644
--- a/lib/pact_broker/client/base_client.rb
+++ b/lib/pact_broker/client/base_client.rb
@@ -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
diff --git a/spec/pacts/pact_broker_client-pact_broker.json b/spec/pacts/pact_broker_client-pact_broker.json
index 878beb87..5e641699 100644
--- a/spec/pacts/pact_broker_client-pact_broker.json
+++ b/spec/pacts/pact_broker_client-pact_broker.json
@@ -197,6 +197,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
@@ -245,6 +246,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
@@ -293,6 +295,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
@@ -341,6 +344,7 @@
"response": {
"status": 400,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"errors": [
@@ -367,6 +371,7 @@
"response": {
"status": 400,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"errors": [
@@ -394,6 +399,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"matrix": [
@@ -462,6 +468,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
@@ -510,6 +517,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
@@ -558,6 +566,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"summary": {
@@ -606,6 +615,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"matrix": [
@@ -651,6 +661,7 @@
"response": {
"status": 201,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
@@ -685,6 +696,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
@@ -719,6 +731,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
@@ -753,6 +766,7 @@
"response": {
"status": 201,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
@@ -820,6 +834,7 @@
"response": {
"status": 201,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
}
}
},
@@ -839,6 +854,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
}
}
},
@@ -924,6 +940,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"consumer": {
@@ -994,12 +1011,13 @@
"method": "get",
"path": "/pacts/provider/Pricing%20Service/consumer/Condor/latest/prod",
"headers": {
- "Accept": "application/json, application/hal+json"
+ "Accept": "application/hal+json, application/json"
}
},
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"consumer": {
@@ -1027,6 +1045,7 @@
"response": {
"status": 201,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
@@ -1056,6 +1075,7 @@
"response": {
"status": 201,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
@@ -1085,6 +1105,7 @@
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
@@ -1108,12 +1129,13 @@
"method": "get",
"path": "/",
"headers": {
- "Accept": "application/json, application/hal+json"
+ "Accept": "application/hal+json, application/json"
}
},
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
@@ -1137,12 +1159,13 @@
"method": "get",
"path": "/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-VERSION-Condor",
"headers": {
- "Accept": "application/json, application/hal+json"
+ "Accept": "application/hal+json, application/json"
}
},
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"number": "1.2.3",
@@ -1167,12 +1190,13 @@
"method": "get",
"path": "/",
"headers": {
- "Accept": "application/json, application/hal+json"
+ "Accept": "application/hal+json, application/json"
}
},
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"_links": {
@@ -1196,12 +1220,13 @@
"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"
}
},
"response": {
"status": 200,
"headers": {
+ "Content-Type": "application/hal+json;charset=utf-8"
},
"body": {
"number": "1.2.3",
diff --git a/spec/service_providers/pact_broker_client_retrieve_pact_spec.rb b/spec/service_providers/pact_broker_client_retrieve_pact_spec.rb
index 419afb3a..cf111943 100644
--- a/spec/service_providers/pact_broker_client_retrieve_pact_spec.rb
+++ b/spec/service_providers/pact_broker_client_retrieve_pact_spec.rb
@@ -70,8 +70,7 @@ module PactBroker::Client
headers: {}
).
will_respond_with(
- status: 404,
- headers: pact_broker_response_headers
+ status: 404
)
end
it "returns nil" do
@@ -89,7 +88,7 @@ module PactBroker::Client
with(
method: :get,
path: '/pacts/provider/Pricing%20Service/consumer/Condor/latest/prod',
- headers: { 'Accept' => 'application/json, application/hal+json'}
+ headers: { 'Accept' => 'application/hal+json, application/json'}
).
will_respond_with(
status: 200,
diff --git a/spec/service_providers/pact_broker_client_versions_spec.rb b/spec/service_providers/pact_broker_client_versions_spec.rb
index cfbbf49d..bacbcd9f 100644
--- a/spec/service_providers/pact_broker_client_versions_spec.rb
+++ b/spec/service_providers/pact_broker_client_versions_spec.rb
@@ -6,7 +6,7 @@
include_context "pact broker"
- let(:get_headers) { { "Accept" => "application/json, application/hal+json" } }
+ let(:get_headers) { { "Accept" => "application/hal+json, application/json" } }
describe "retrieving the latest pacticipant version" do
let(:latest_version_path) { "/HAL-REL-PLACEHOLDER-INDEX-PB-LATEST-VERSION-{pacticipant}" }
diff --git a/spec/support/shared_context.rb b/spec/support/shared_context.rb
index 75e17fa0..d01daea6 100644
--- a/spec/support/shared_context.rb
+++ b/spec/support/shared_context.rb
@@ -9,9 +9,10 @@
let(:consumer_version) { '1.3.0' }
let(:version) { '1.3.0' }
let(:pact_broker_version) { Pact::Term.new(:matcher => /\d+\.\d+\.\d+/, :generate => '1.0.0') }
- let(:pact_broker_response_headers) { {} }
+ let(:pact_broker_response_headers) { {'Content-Type' => 'application/hal+json;charset=utf-8'} }
let(:default_request_headers) { { 'Content-Type' => 'application/json'} }
let(:patch_request_headers) { { 'Content-Type' => 'application/json'} }
- let(:get_request_headers) { { 'Accept' => 'application/json'} }
+ let(:put_request_headers) { { 'Content-Type' => 'application/json', 'Accept' => 'application/hal+json'} }
+ let(:get_request_headers) { { 'Accept' => 'application/hal+json'} }
end