@@ -367,6 +367,49 @@ describe('aws4', function() {
367
367
} )
368
368
} )
369
369
370
+ describe ( '#sign() with extraHeadersToIgnore' , function ( ) {
371
+ it ( 'should generate signature correctly' , function ( ) {
372
+ var opts = aws4 . sign ( {
373
+ host : '07tjusf2h91cunochc.us-east-1.aoss.amazonaws.com' ,
374
+ method : 'PUT' ,
375
+ path : '/my-index' ,
376
+ body : '{"mappings":{}}' ,
377
+ headers : {
378
+ Date : date ,
379
+ 'Content-Type' : 'application/json' ,
380
+ 'X-Amz-Content-Sha256' : 'UNSIGNED-PAYLOAD' ,
381
+ } ,
382
+ extraHeadersToIgnore : {
383
+ 'content-length' : true
384
+ } ,
385
+ } )
386
+ opts . headers . Authorization . should . equal (
387
+ 'AWS4-HMAC-SHA256 Credential=ABCDEF/20121226/us-east-1/aoss/aws4_request, ' +
388
+ 'SignedHeaders=content-type;date;host;x-amz-content-sha256;x-amz-date, ' +
389
+ 'Signature=ade8635c05bfa4961bc28be0b0a0fbfd3d64e79feb1862f822ee6a4517417bcd' )
390
+ } )
391
+ } )
392
+
393
+ describe ( '#sign() with extraHeadersToInclude' , function ( ) {
394
+ it ( 'should generate signature correctly' , function ( ) {
395
+ var opts = aws4 . sign ( {
396
+ service : 'someservice' ,
397
+ path : '/whatever' ,
398
+ headers : {
399
+ Date : date ,
400
+ 'Range' : 'bytes=200-1000, 2000-6576, 19000-' ,
401
+ } ,
402
+ extraHeadersToInclude : {
403
+ 'range' : true
404
+ } ,
405
+ } )
406
+ opts . headers . Authorization . should . equal (
407
+ 'AWS4-HMAC-SHA256 Credential=ABCDEF/20121226/us-east-1/someservice/aws4_request, ' +
408
+ 'SignedHeaders=date;host;range;x-amz-date, ' +
409
+ 'Signature=8f3eba7a5743091daae62d00ce1c911c018d48f72dbdf180b15abe701718317a' )
410
+ } )
411
+ } )
412
+
370
413
describe ( '#signature() with CodeCommit Git access' , function ( ) {
371
414
it ( 'should generate signature correctly' , function ( ) {
372
415
var signer = new RequestSigner ( {
0 commit comments