Skip to content

Instantly share code, notes, and snippets.

@AlexWheeler
Created Jan 21, 2017
Embed
What would you like to do?
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