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