Sha256: 8fc9965bb5bb7784ee48df316f104ec2b2d9d36a7991affaf77e70331ba95a6c

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

# frozen_string_literal: true

require "net/http"
require "timeout"

require "github_authentication/retriable"

module GithubAuthentication
  module Http
    class << self
      include Retriable

      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
github-authentication-1.1.0 lib/github_authentication/http.rb