mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
show the header in the logs when aws sigv4 fails
This commit is contained in:
parent
d9326ac027
commit
ef8ad355e9
@ -91,10 +91,12 @@ class HTTPXAwsSigv4Test < Minitest::Test
|
||||
body: StringIO.new("http-body")
|
||||
)
|
||||
|
||||
assert request.headers["authorization"] == "" \
|
||||
"AWS4-HMAC-SHA256 Credential=akid/20120101/REGION/SERVICE/aws4_request, " \
|
||||
"SignedHeaders=bar;bar2;foo;host;x-amz-content-sha256;x-amz-date, " \
|
||||
"Signature=4a7d3e06d1950eb64a3daa1becaa8ba030d9099858516cb2fa4533fab4e8937d"
|
||||
expected_authorization = "" \
|
||||
"AWS4-HMAC-SHA256 Credential=akid/20120101/REGION/SERVICE/aws4_request, " \
|
||||
"SignedHeaders=bar;bar2;foo;host;x-amz-content-sha256;x-amz-date, " \
|
||||
"Signature=4a7d3e06d1950eb64a3daa1becaa8ba030d9099858516cb2fa4533fab4e8937d"
|
||||
assert request.headers["authorization"] == expected_authorization,
|
||||
"expected: \"#{expected_authorization}\", got \"#{request.headers["authorization"]}\" inspected"
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -10,15 +10,19 @@ module Requests
|
||||
def test_plugin_aws_authentication_put_object
|
||||
amz_uri = origin(AWS_URI)
|
||||
|
||||
s3_client = Aws::S3::Client.new(
|
||||
endpoint: amz_uri,
|
||||
force_path_style: true,
|
||||
ssl_verify_peer: false,
|
||||
# http_wire_trace: true,
|
||||
# logger: Logger.new(STDERR)
|
||||
)
|
||||
s3_client.create_bucket(bucket: "test", acl: "private")
|
||||
object = s3_client.put_object(bucket: "test", key: "testimage", body: "bucketz")
|
||||
begin
|
||||
s3_client = Aws::S3::Client.new(
|
||||
endpoint: amz_uri,
|
||||
force_path_style: true,
|
||||
ssl_verify_peer: false,
|
||||
http_wire_trace: true,
|
||||
logger: Logger.new(STDERR)
|
||||
)
|
||||
s3_client.create_bucket(bucket: "test", acl: "private")
|
||||
object = s3_client.put_object(bucket: "test", key: "testimage", body: "bucketz")
|
||||
rescue Aws::S3::Errors::BucketAlreadyExists
|
||||
# because this test will run 2 times (http and https)
|
||||
end
|
||||
|
||||
# now let's get it
|
||||
# no_sig_response = HTTPX.get("http://#{AWS_URI}/test/testimage")
|
||||
|
Loading…
x
Reference in New Issue
Block a user