return 202 after receive
This commit is contained in:
parent
55f3c2dce0
commit
127b603558
2 changed files with 6 additions and 6 deletions
|
|
@ -16,7 +16,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
DiasporaFederation.callbacks.trigger(:queue_public_receive, xml)
|
DiasporaFederation.callbacks.trigger(:queue_public_receive, xml)
|
||||||
|
|
||||||
render nothing: true, status: :ok
|
render nothing: true, status: 202
|
||||||
end
|
end
|
||||||
|
|
||||||
# receives private messages for a user
|
# receives private messages for a user
|
||||||
|
|
@ -29,7 +29,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
success = DiasporaFederation.callbacks.trigger(:queue_private_receive, params[:guid], xml)
|
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
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@ module DiasporaFederation
|
||||||
expect(response.code).to eq("422")
|
expect(response.code).to eq("422")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns a 200 if queued correctly" do
|
it "returns a 202 if queued correctly" do
|
||||||
expect(DiasporaFederation.callbacks).to receive(:trigger)
|
expect(DiasporaFederation.callbacks).to receive(:trigger)
|
||||||
.with(:queue_public_receive, "<diaspora/>")
|
.with(:queue_public_receive, "<diaspora/>")
|
||||||
|
|
||||||
post :public, xml: "<diaspora/>"
|
post :public, xml: "<diaspora/>"
|
||||||
expect(response.code).to eq("200")
|
expect(response.code).to eq("202")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "unescapes the xml before sending it to the callback" do
|
it "unescapes the xml before sending it to the callback" do
|
||||||
|
|
@ -39,13 +39,13 @@ module DiasporaFederation
|
||||||
expect(response.code).to eq("422")
|
expect(response.code).to eq("422")
|
||||||
end
|
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)
|
expect(DiasporaFederation.callbacks).to receive(:trigger)
|
||||||
.with(:queue_private_receive, "any-guid", "<diaspora/>")
|
.with(:queue_private_receive, "any-guid", "<diaspora/>")
|
||||||
.and_return(true)
|
.and_return(true)
|
||||||
|
|
||||||
post :private, guid: "any-guid", xml: "<diaspora/>"
|
post :private, guid: "any-guid", xml: "<diaspora/>"
|
||||||
expect(response.code).to eq("200")
|
expect(response.code).to eq("202")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "unescapes the xml before sending it to the callback" do
|
it "unescapes the xml before sending it to the callback" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue