httpx/examples/s3.rb
HoneyryderChuck 3f3e1cd9cf limiting the number of max concurrent connnections for the awk
authentication plugin

TIL that S3 does not speak HTTP/2 (cloudfront does). Also, AWS sigv4
verification breaks with pipelined requests, therefore, we have to send
them one at a time.

GCP does provide HTTP/2 support, so let's test there as well.
2021-02-05 18:42:39 +00:00

20 lines
564 B
Ruby

require "httpx"
FILE = "test/support/fixtures/image.jpg"
BUCKET_URL = "https://httpx-tests.s3.eu-west-1.amazonaws.com"
aws_httpx = HTTPX.plugin(:aws_sdk_authentication).aws_sdk_authentication(service: "s3")
requests = (1..5).map{ |i| aws_httpx.build_request(:put, BUCKET_URL + "/image-#{i}", body: File.new(FILE)) }
responses = aws_httpx.request(*requests)
# responses = aws_httpx.get(BUCKET_URL + "/image")
Array(responses).each(&:raise_for_status)
puts "Status: \n"
puts Array(responses).map(&:status)
puts "Payload: \n"
puts Array(responses).map(&:to_s)