From 127b603558ccd030c3a2a0f2b38810038bc1e36c Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Wed, 30 Dec 2015 03:45:18 +0100 Subject: [PATCH] return 202 after receive --- app/controllers/diaspora_federation/receive_controller.rb | 4 ++-- .../diaspora_federation/receive_controller_spec.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/diaspora_federation/receive_controller.rb b/app/controllers/diaspora_federation/receive_controller.rb index db15008..8c46f34 100644 --- a/app/controllers/diaspora_federation/receive_controller.rb +++ b/app/controllers/diaspora_federation/receive_controller.rb @@ -16,7 +16,7 @@ module DiasporaFederation DiasporaFederation.callbacks.trigger(:queue_public_receive, xml) - render nothing: true, status: :ok + render nothing: true, status: 202 end # receives private messages for a user @@ -29,7 +29,7 @@ module DiasporaFederation success = DiasporaFederation.callbacks.trigger(:queue_private_receive, params[:guid], xml) - render nothing: true, status: success ? :ok : 404 + render nothing: true, status: success ? 202 : 404 end private diff --git a/spec/controllers/diaspora_federation/receive_controller_spec.rb b/spec/controllers/diaspora_federation/receive_controller_spec.rb index 6e28b69..e158f58 100644 --- a/spec/controllers/diaspora_federation/receive_controller_spec.rb +++ b/spec/controllers/diaspora_federation/receive_controller_spec.rb @@ -8,12 +8,12 @@ module DiasporaFederation expect(response.code).to eq("422") end - it "returns a 200 if queued correctly" do + it "returns a 202 if queued correctly" do expect(DiasporaFederation.callbacks).to receive(:trigger) .with(:queue_public_receive, "") post :public, xml: "" - expect(response.code).to eq("200") + expect(response.code).to eq("202") end it "unescapes the xml before sending it to the callback" do @@ -39,13 +39,13 @@ module DiasporaFederation expect(response.code).to eq("422") end - it "returns a 200 if the callback returned true" do + it "returns a 202 if the callback returned true" do expect(DiasporaFederation.callbacks).to receive(:trigger) .with(:queue_private_receive, "any-guid", "") .and_return(true) post :private, guid: "any-guid", xml: "" - expect(response.code).to eq("200") + expect(response.code).to eq("202") end it "unescapes the xml before sending it to the callback" do