Skip to content

Commit

Permalink
Test case with a provided x-amz-content-sha256 header
Browse files Browse the repository at this point in the history
  • Loading branch information
José Borges Ferreira committed Aug 22, 2018
1 parent 4074886 commit 8d9c9b8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion t/20-sign.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!perl

use Test::More tests => 6;
use Test::More tests => 7;

BEGIN {
use_ok( 'Net::Amazon::Signature::V4' ) || print "Bail out!\n";
Expand All @@ -9,6 +9,7 @@ BEGIN {
use Net::Amazon::Signature::V4;
use HTTP::Request;

my $sha = '0123456789abcfdef0123456789abcfdef0123456789abcfdef0123456789abcfdef';
my $sig = Net::Amazon::Signature::V4->new(
'AKIDEXAMPLE',
'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY',
Expand All @@ -24,3 +25,7 @@ isnt($signed_req->header("x-amz-date"), '', "Inserted x-amz-date header");
isnt($signed_req->header("authorization"), '', "Inserted authorization header");
isnt($signed_req->header("X-Amz-Content-Sha256"), '', "Inserted x-amz-content-sha256 header");

my $req = HTTP::Request->new( 'GET', 'http://hostname.example.net/something/cool' );
$req->header("X-Amz-Content-Sha256",$sha);
my $signed_req = $sig->sign( $req );
is($signed_req->header("X-Amz-Content-Sha256"), $sha, "x-amz-content-sha256 is kept");

0 comments on commit 8d9c9b8

Please sign in to comment.