module Github::Authentication::Http

Public Class Methods

post(url) { |request| ... } click to toggle source
# File lib/github/authentication/http.rb, line 14
def post(url)
  uri = URI.parse(url)
  with_retries(SystemCallError, Timeout::Error) do
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true
    http.start
    begin

      request = Net::HTTP::Post.new(uri.request_uri)
      yield(request) if block_given?

      http.request(request)
    ensure
      http.finish
    end
  end
end