Skip to content

Commit

Permalink
fix: don't load webhook authentication if Rack not present
Browse files Browse the repository at this point in the history
Now that the webhook authentication requires part of Rack to run, loading the gem in a context that doesn't include Rack fails. For most people this won't happen as it will be used in the context of a web framework and most Ruby web frameworks rely on Rack. However, simple scripts that don't have Rack loaded will fail because the application can't load rack/media_type. In these cases, since Rack is not present, rack middleware won't be helpful either, so we only load the Rack middleware if Rack is present.
  • Loading branch information
philnash committed Mar 6, 2022
1 parent f947d94 commit ee15310
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/twilio-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require 'json'

require 'twilio-ruby/version' unless defined?(Twilio::VERSION)
require 'rack/twilio_webhook_authentication'
require 'rack/twilio_webhook_authentication' if defined?(Rack)

require 'twilio-ruby/util'
require 'twilio-ruby/security/request_validator'
Expand Down

0 comments on commit ee15310

Please sign in to comment.