lib/httpx/resolver/https.rb in httpx-0.20.5 vs lib/httpx/resolver/https.rb in httpx-0.21.0
- old
+ new
@@ -100,11 +100,11 @@
request.on(:response, &method(:on_response).curry(2)[request])
request.on(:promise, &method(:on_promise))
@requests[request] = hostname
resolver_connection.send(request)
@connections << connection
- rescue ResolveError, Resolv::DNS::EncodeError, JSON::JSONError => e
+ rescue ResolveError, Resolv::DNS::EncodeError => e
@queries.delete(hostname)
emit_resolve_error(connection, connection.origin.host, e)
end
end
@@ -127,11 +127,11 @@
end
def parse(request, response)
begin
answers = decode_response_body(response)
- rescue Resolv::DNS::DecodeError, JSON::JSONError => e
+ rescue Resolv::DNS::DecodeError => e
host, connection = @queries.first
@queries.delete(host)
emit_resolve_error(connection, connection.origin.host, e)
return
end
@@ -201,14 +201,9 @@
request
end
def decode_response_body(response)
case response.headers["content-type"]
- when "application/dns-json",
- "application/json",
- %r{^application/x-javascript} # because google...
- payload = JSON.parse(response.to_s)
- payload["Answer"]
when "application/dns-udpwireformat",
"application/dns-message"
Resolver.decode_dns_answer(response.to_s)
else
raise Error, "unsupported DNS mime-type (#{response.headers["content-type"]})"