mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-12-04 00:01:13 -05:00
18 lines
378 B
Ruby
18 lines
378 B
Ruby
require "httpx"
|
|
require "json"
|
|
|
|
include HTTPX
|
|
|
|
URLS = %w[http://httpbin.org/post]
|
|
|
|
$HTTPX_DEBUG = true
|
|
client = Client.new
|
|
requests = URLS.map { |url| client.request(:post, url, json: {"bang" => "bang"}) }
|
|
responses = client.send(*requests)
|
|
|
|
responses.each do |res|
|
|
puts "status: #{res.status}"
|
|
puts "body: #{JSON.parse(res.body.to_s)}"
|
|
end
|
|
# puts responses.map(&:status)
|