Skip to content

Commit c177fdd

Browse files
committed
fix: set correct content type for verification result resources
1 parent 0f9d0b0 commit c177fdd

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

lib/pact_broker/api/resources/verification.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Resources
1111
class Verification < BaseResource
1212

1313
def content_types_provided
14-
[["application/json", :to_json]]
14+
[["application/hal+json", :to_json], ["application/json", :to_json]]
1515
end
1616

1717
def allowed_methods

lib/pact_broker/api/resources/verifications.rb

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ def content_types_accepted
1414
[["application/json", :from_json]]
1515
end
1616

17+
def content_types_provided
18+
[["application/hal+json", :to_json]]
19+
end
20+
1721
def allowed_methods
1822
["POST"]
1923
end

spec/features/publish_verification_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
let(:parsed_response_body) { JSON.parse(subject.body) }
99
let(:pact) { td.pact }
1010

11-
subject { post path, verification_content, {'CONTENT_TYPE' => 'application/json' }; last_response }
11+
subject { post path, verification_content, {'CONTENT_TYPE' => 'application/json', 'HTTP_ACCEPT' => 'application/hal+json' }; last_response }
1212

1313
before do
1414
td.create_provider("Provider")
@@ -40,7 +40,7 @@
4040

4141
it "returns a link to itself that can be followed" do
4242
get_verification_link = parsed_response_body['_links']['self']['href']
43-
get get_verification_link
43+
get get_verification_link, nil, { 'HTTP_ACCEPT' => 'application/hal+json' }
4444
expect(last_response.status).to be 200
4545
expect(JSON.parse(subject.body)).to include JSON.parse(verification_content)
4646
end

0 commit comments

Comments
 (0)