mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-05 00:02:38 -04:00
better example
This commit is contained in:
parent
2ef5c05b63
commit
bf757d194f
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user