Skip to content

Commit

Permalink
feat(webhooks): return a 200 status for webhook test execution respon…
Browse files Browse the repository at this point in the history
…se even when execution has failed
  • Loading branch information
bethesque committed May 24, 2019
1 parent 9ab66df commit d90c455
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions lib/pact_broker/api/resources/webhook_execution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ def process_post
webhook_execution_result = webhook_service.test_execution(webhook, webhook_options)
response.headers['Content-Type'] = 'application/hal+json;charset=utf-8'
response.body = post_response_body webhook_execution_result
if webhook_execution_result.success?
true
else
response.headers[PactBroker::DO_NOT_ROLLBACK] = 'true'
500
end
true
end

def resource_exists?
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/pact_broker/api/resources/webhook_execution_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ module Resources
context "when execution is not successful" do
let(:success) { false }

it "returns a 500 JSON response" do
it "returns a 200 JSON response" do
subject
expect(last_response.status).to eq 500
expect(last_response.status).to eq 200
end

it "includes the execution result JSON in the body" do
Expand Down

0 comments on commit d90c455

Please sign in to comment.