From 0c609e6fd99a41efb79abe3e2e9a0682ca13acec Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Sat, 24 Feb 2018 22:13:55 +0000 Subject: [PATCH] cleaned up example --- examples/get.rb | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/examples/get.rb b/examples/get.rb index a42af66c..74d6c35a 100644 --- a/examples/get.rb +++ b/examples/get.rb @@ -1,27 +1,10 @@ require "httpx" -include HTTPX +URLS = %w[https://nghttp2.org/httpbin/get] * 1 -# supports HTTP/1 pipelining and HTTP/2 -URLS = %w[https://nghttp2.org https://nghttp2.org/blog/] * 51 - - -# supports HTTP/2 and HTTP/1 Keep-Alive -# URLS = %w[http://nghttp2.org/httpbin/] * 102 -# -# supports HTTP/1 pipelining -# URLS = %w[https://github.com https://github.com/blog] - -$HTTPX_DEBUG = true -# responses = HTTPX.get(URLS) -# puts responses.map(&:status) -response = HTTPX.get(URLS.first) -puts response.status -# response = HTTPX.get(URLS.last) -# puts response.status -# response = HTTPX.get(URLS.last) - -#responses.each do |res| -# puts "status: #{res.status}, length: #{res.body.to_s.bytesize}" -#end +responses = HTTPX.get(*URLS) +puts "Status: \n" +puts Array(responses).map(&:status) +puts "Payload: \n" +puts Array(responses).map(&:to_s)