Comparing version 1.13.0 to 1.13.1
40
aws4.js
@@ -298,25 +298,27 @@ var aws4 = exports, | ||
RequestSigner.prototype.filterHeaders = function() { | ||
var headers = this.request.headers, | ||
extraHeadersToInclude = this.extraHeadersToInclude, | ||
extraHeadersToIgnore = this.extraHeadersToIgnore | ||
this.filteredHeaders = Object.keys(headers) | ||
.map(function(key) { return [key.toLowerCase(), headers[key]] }) | ||
.filter(function(entry) { | ||
return extraHeadersToInclude[entry[0]] || | ||
(HEADERS_TO_IGNORE[entry[0]] == null && !extraHeadersToIgnore[entry[0]]) | ||
}) | ||
.sort(function(a, b) { return a[0] < b[0] ? -1 : 1 }) | ||
} | ||
RequestSigner.prototype.canonicalHeaders = function() { | ||
var headers = this.request.headers | ||
function trimAll(header) { | ||
return header.toString().trim().replace(/\s+/g, ' ') | ||
} | ||
return Object.keys(headers) | ||
.filter(function(key) { return HEADERS_TO_IGNORE[key.toLowerCase()] == null }) | ||
.sort(function(a, b) { return a.toLowerCase() < b.toLowerCase() ? -1 : 1 }) | ||
.map(function(key) { return key.toLowerCase() + ':' + trimAll(headers[key]) }) | ||
.join('\n') | ||
if (!this.filteredHeaders) this.filterHeaders() | ||
return this.filteredHeaders.map(function(entry) { | ||
return entry[0] + ':' + entry[1].toString().trim().replace(/\s+/g, ' ') | ||
}).join('\n') | ||
} | ||
RequestSigner.prototype.signedHeaders = function() { | ||
var extraHeadersToInclude = this.extraHeadersToInclude, | ||
extraHeadersToIgnore = this.extraHeadersToIgnore | ||
return Object.keys(this.request.headers) | ||
.map(function(key) { return key.toLowerCase() }) | ||
.filter(function(key) { | ||
return extraHeadersToInclude[key] || | ||
(HEADERS_TO_IGNORE[key] == null && !extraHeadersToIgnore[key]) | ||
}) | ||
.sort() | ||
.join(';') | ||
if (!this.filteredHeaders) this.filterHeaders() | ||
return this.filteredHeaders.map(function(entry) { return entry[0] }).join(';') | ||
} | ||
@@ -323,0 +325,0 @@ |
{ | ||
"name": "aws4", | ||
"version": "1.13.0", | ||
"version": "1.13.1", | ||
"description": "Signs and prepares requests using AWS Signature Version 4", | ||
@@ -18,5 +18,5 @@ "author": "Michael Hart <michael.hart.au@gmail.com> (https://github.com/mhart)", | ||
"devDependencies": { | ||
"mocha": "^10.4.0", | ||
"mocha": "^10.7.0", | ||
"should": "^13.2.3" | ||
} | ||
} |
aws4 | ||
---- | ||
[![Build Status](https://api.travis-ci.org/mhart/aws4.png?branch=master)](https://travis-ci.org/github/mhart/aws4) | ||
A small utility to sign vanilla Node.js http(s) request options using Amazon's | ||
A small utility to sign [vanilla Node.js http(s)](https://nodejs.org/api/http.html) request options using Amazon's | ||
[AWS Signature Version 4](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). | ||
If you want to sign and send AWS requests in a browser, or an environment like [Cloudflare Workers](https://developers.cloudflare.com/workers/), then check out [aws4fetch](https://github.com/mhart/aws4fetch) – otherwise you can also bundle this library for use [in older browsers](./browser). | ||
If you want to sign and send AWS requests using [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API), then check out [aws4fetch](https://github.com/mhart/aws4fetch) – otherwise you can also bundle this library for use [in older browsers](./browser). | ||
The only AWS service that *doesn't* support v4 as of 2020-05-22 is | ||
The only AWS service I know of that *doesn't* support v4 is | ||
[SimpleDB](https://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/SDB_API.html) | ||
@@ -13,0 +11,0 @@ (it only supports [AWS Signature Version 2](https://github.com/mhart/aws2)). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23389
392
212