Module: PactBroker::Api::Resources::PactResourceMethods

Included in:
Pact, PactVersionsForBranch, TaggedPactVersions
Defined in:
lib/pact_broker/api/resources/pact_resource_methods.rb

Instance Method Summary collapse

Instance Method Details

#set_post_deletion_responseObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pact_broker/api/resources/pact_resource_methods.rb', line 5

def set_post_deletion_response
  latest_pact = pact_service.find_latest_pact(
    consumer_name: pact_params[:consumer_name],
    provider_name: pact_params[:provider_name]
  )
  response_body = { "_links" => { index: { href: base_url } } }
  if latest_pact
    response_body["_links"]["pb:latest-pact-version"] = {
      href: latest_pact_url(base_url, latest_pact),
      title: "Latest pact"
    }
  end
  response.body = response_body.to_json
  response.headers["Content-Type" => "application/hal+json;charset=utf-8"]
end