Created
December 1, 2017 10:49
-
-
Save nicklegr/5889f8629b6afe2c4236c6e6e7939364 to your computer and use it in GitHub Desktop.
yt gemのプロキシ対応
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# プロキシを通すためメソッドを上書き | |
# 元のメソッドは 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