Skip to content

Instantly share code, notes, and snippets.

@nicklegr
Created December 1, 2017 10:49
Show Gist options
  • Save nicklegr/5889f8629b6afe2c4236c6e6e7939364 to your computer and use it in GitHub Desktop.
Save nicklegr/5889f8629b6afe2c4236c6e6e7939364 to your computer and use it in GitHub Desktop.
yt gemのプロキシ対応
# プロキシを通すためメソッドを上書き
# 元のメソッドは https://github.com/Fullscreen/yt/blob/v0.32.1/lib/yt/request.rb#L170
module Yt
class Request
private
def send_http_request
net_http_options = [uri.host, uri.port, :ENV, use_ssl: true]
ActiveSupport::Notifications.instrument 'request.yt' do |payload|
payload[:method] = @method
payload[:request_uri] = uri
payload[:response] = Net::HTTP.start(*net_http_options) do |http|
http.request http_request
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment