FIX: Accept HEAD requests for mandrill webhook (#17180)
Madrill uses a HEAD request for validation, accept it.
This commit is contained in:
parent
c9a3aba5a2
commit
f590b62a31
|
@ -66,6 +66,12 @@ class WebhooksController < ActionController::Base
|
|||
success
|
||||
end
|
||||
|
||||
def mandrill_head
|
||||
# Mandrill sends a HEAD request to validate the webhook before saving
|
||||
# Rails interprets it as a GET request
|
||||
success
|
||||
end
|
||||
|
||||
def postmark
|
||||
# see https://postmarkapp.com/developer/webhooks/bounce-webhook#bounce-webhook-data
|
||||
# and https://postmarkapp.com/developer/api/bounce-api#bounce-types
|
||||
|
|
|
@ -22,6 +22,7 @@ Discourse::Application.routes.draw do
|
|||
post "webhooks/mailgun" => "webhooks#mailgun"
|
||||
post "webhooks/mailjet" => "webhooks#mailjet"
|
||||
post "webhooks/mandrill" => "webhooks#mandrill"
|
||||
get "webhooks/mandrill" => "webhooks#mandrill_head"
|
||||
post "webhooks/postmark" => "webhooks#postmark"
|
||||
post "webhooks/sendgrid" => "webhooks#sendgrid"
|
||||
post "webhooks/sparkpost" => "webhooks#sparkpost"
|
||||
|
|
|
@ -155,6 +155,14 @@ RSpec.describe WebhooksController do
|
|||
end
|
||||
end
|
||||
|
||||
context "mandrill_head" do
|
||||
it "works" do
|
||||
head "/webhooks/mandrill.json"
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
end
|
||||
end
|
||||
|
||||
context "postmark" do
|
||||
it "works" do
|
||||
user = Fabricate(:user, email: email)
|
||||
|
|
Loading…
Reference in New Issue