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
module Request | |
HEADERS = { 'Content-Type' => 'application/json' }.freeze | |
def self.add_headers(headers) | |
HEADERS.merge!(headers) | |
end | |
def get_request(path) | |
uri = URI.parse(path) | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Get.new(uri.request_uri, HEADERS) | |
response = http.request(request) | |
end | |
end | |
class Client | |
include Request | |
def initialize() | |
Request.add_headers("X-Custom" => "foo") | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment