Module: GithubAuthentication::Http

Extended by:
Retriable
Defined in:
lib/github_authentication/http.rb

Class Method Summary collapse

Methods included from Retriable

with_retries

Class Method Details

.post(url) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/github_authentication/http.rb', line 13

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