Skip to content

Commit

Permalink
Require SSL.
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Puchalski committed Apr 27, 2012
1 parent 01f730c commit 7a41d81
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/controllers/sendgrid_postback/events_controller.rb
Expand Up @@ -7,6 +7,12 @@ class SendgridPostback::EventsController < ActionController::Metal
# curl -i -H "Content-Type: application/json" -X POST -d '{"email": "test2@gmail.com", "event": "processed2"}' https://localhost:3000/sendgrid_postback/events
# curl -i -H "Content-Type: application/json" -X POST -d '{"email": "test@gmail.com", "event": "processed"}{"email": "test2@gmail.com", "event": "processed2"}' https://localhost:3000/sendgrid_postback/events
def create
unless request.ssl?
self.response_body = ''
self.status = :bad_request
return
end

parse_send_grid_events do |data|
receiver = SendgridPostback.config.find_receiver_by_uuid.call(data[:uuid])
if receiver.blank?
Expand All @@ -18,7 +24,8 @@ def create
self.response_body = ''
rescue => exc
SendgridPostback.config.report_exception.call(exc)
render nothing: true, status: :internal_server_error
self.response_body = ''
self.status = :internal_server_error
end

private
Expand Down

0 comments on commit 7a41d81

Please sign in to comment.