better example

This commit is contained in:
HoneyryderChuck 2017-11-29 18:29:11 +00:00
parent 2ef5c05b63
commit bf757d194f

View File

@ -2,15 +2,17 @@ require "httpx"
include HTTPX
# URL = "http://nghttp2.org"
URL = "https://nghttp2.org"
# URL = "https://github.com"
# supports HTTP/1 pipelining and HTTP/2
URLS = %w[https://nghttp2.org https://nghttp2.org/blog/]
#
# supports HTTP/1 pipelining
# URLS = %w[https://github.com https://github.com/blog]
$HTTPX_DEBUG = true
client = Client.new
request = client.request(:get, URL)
response = client.send(request)
requests = URLS.map { |url| client.request(:get, url) }
responses = client.send(*requests)
puts response.status
puts responses.map(&:status)
client.close