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