fixed Patron hack in case the library is not available

This commit is contained in:
Mislav Marohnić 2011-05-13 14:56:28 -07:00
parent 9fc7d7e4c1
commit 4a9405d216

View File

@ -22,12 +22,15 @@ module Faraday
@app.call env
end
end
# HAX: helps but doesn't work completely
# https://github.com/toland/patron/issues/34
valid_actions = ::Patron::Request::VALID_ACTIONS
valid_actions << :patch unless valid_actions.include? :patch
valid_actions << :options unless valid_actions.include? :options
if loaded? && defined?(::Patron::Request::VALID_ACTIONS)
# HAX: helps but doesn't work completely
# https://github.com/toland/patron/issues/34
::Patron::Request::VALID_ACTIONS.tap do |actions|
actions << :patch unless actions.include? :patch
actions << :options unless actions.include? :options
end
end
end
end
end