Sha256: b488fcdad1ad4cbeed7f7cba74bb85b0566ede088e1d78aedb4f515f59ec28e8

Contents?: true

Size: 627 Bytes

Versions: 5

Compression:

Stored size: 627 Bytes

Contents

#!/usr/bin/env ruby

gem 'async'
gem 'async-http'
gem 'trenni'

require 'async/reactor'
require 'async/http/client'
require 'async/http/url_endpoint'

require 'trenni/uri'

endpoint = Async::HTTP::URLEndpoint.parse("https://cloudflare-dns.com/dns-query")
client = Async::HTTP::Client.new(endpoint)

Async::Reactor.run do |task|
	request_uri = Trenni::URI(endpoint.url.request_uri, ct: "application/dns-json", name: "microsoft.com", type: "MX")
	
	puts "GET #{request_uri}"
	response = client.get(request_uri.to_s, {})
	
	puts "#{response.status} #{response.version} #{response.headers.inspect}"
	puts response.read.inspect
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
async-dns-1.2.5 examples/cloudflare.rb
async-dns-1.2.4 examples/cloudflare.rb
async-dns-1.2.3 examples/cloudflare.rb
async-dns-1.2.2 examples/cloudflare.rb
async-dns-1.2.1 examples/cloudflare.rb