about summary refs log tree commit diff
path: root/app/controllers/api
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2017-10-03 23:21:19 +0200
committerEugen Rochko <eugen@zeonfederated.com>2017-10-03 23:21:19 +0200
commitdfaa219f8820224d37cd060d253a507111c63460 (patch)
treed84960bb81f1203489ed1a7cb3f1d919b64d05d7 /app/controllers/api
parente6543d5fc4d4f6ec7020d104e4d2360ee9bd7679 (diff)
Fix HTTP responses for salmon and ActivityPub inbox processing (#5200)
* Return sensible HTTP status for ActivityPub inbox processing

* Return sensible HTTP status for salmon slap processing

* Return additional information to debug signature verification failures
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/salmon_controller.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/api/salmon_controller.rb b/app/controllers/api/salmon_controller.rb
index e9e700b18..143e9d3cd 100644
--- a/app/controllers/api/salmon_controller.rb
+++ b/app/controllers/api/salmon_controller.rb
@@ -7,9 +7,11 @@ class Api::SalmonController < Api::BaseController
   def update
     if verify_payload?
       process_salmon
-      head 201
-    else
       head 202
+    elsif payload.present?
+      [signature_verification_failure_reason, 401]
+    else
+      head 400
     end
   end