aws4-axios
Advanced tools
Comparing version 3.3.1 to 3.3.2
@@ -15,5 +15,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const client_sts_1 = require("@aws-sdk/client-sts"); | ||
const axios_1 = __importDefault(require("axios")); | ||
const __1 = require(".."); | ||
const client_sts_1 = require("@aws-sdk/client-sts"); | ||
const methods = ["GET", "DELETE"]; | ||
@@ -97,2 +97,3 @@ const dataMethods = ["POST", "PATCH", "PUT"]; | ||
data, | ||
headers: { foo: "bar" }, | ||
}); | ||
@@ -105,5 +106,6 @@ } | ||
expect(result === null || result === void 0 ? void 0 : result.status).toEqual(200); | ||
expect(result && result.data.requestContext.http.method).toBe(method); | ||
expect(result && result.data.requestContext.http.path).toBe("/"); | ||
expect(result === null || result === void 0 ? void 0 : result.data.requestContext.http.method).toBe(method); | ||
expect(result === null || result === void 0 ? void 0 : result.data.requestContext.http.path).toBe("/"); | ||
expect(result && JSON.parse(result.data.body)).toStrictEqual(data); | ||
expect(result === null || result === void 0 ? void 0 : result.data.headers.foo).toEqual("bar"); | ||
})); | ||
@@ -110,0 +112,0 @@ it("handles path", () => __awaiter(void 0, void 0, void 0, function* () { |
@@ -96,3 +96,3 @@ "use strict"; | ||
const { data, method } = config; | ||
const headers = new axios_1.AxiosHeaders(config.headers); | ||
const headers = config.headers; | ||
const transformRequest = getTransformer(config); | ||
@@ -118,3 +118,6 @@ transformRequest.bind(config); | ||
(0, aws4_1.sign)(signingOptions, resolvedCredentials); | ||
config.headers = signingOptions.headers; | ||
const signedHeaders = signingOptions.headers; | ||
if (signedHeaders) { | ||
config.headers = axios_1.AxiosHeaders.from(outgoingHttpHeadersToAxiosHeaders(signedHeaders)); | ||
} | ||
if (signingOptions.signQuery) { | ||
@@ -131,2 +134,11 @@ const originalUrl = new URL(url); | ||
exports.aws4Interceptor = aws4Interceptor; | ||
const outgoingHttpHeadersToAxiosHeaders = (headers) => { | ||
const axiosHeaders = {}; | ||
for (const [key, value] of Object.entries(headers)) { | ||
if (value) { | ||
axiosHeaders[key] = value; | ||
} | ||
} | ||
return axiosHeaders; | ||
}; | ||
const getTransformer = (config) => { | ||
@@ -133,0 +145,0 @@ const { transformRequest } = config; |
{ | ||
"name": "aws4-axios", | ||
"version": "3.3.1", | ||
"version": "3.3.2", | ||
"description": "Axios request interceptor for signing requests with AWSv4", | ||
@@ -43,3 +43,3 @@ "author": "James Bourne", | ||
"@types/jest": "^27.0.1", | ||
"@types/node": "^18.16.3", | ||
"@types/node": "^20.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.0.0", | ||
@@ -51,9 +51,9 @@ "@typescript-eslint/parser": "^5.0.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"husky": "^8.0.0", | ||
"husky": "^9.0.0", | ||
"jest": "^26.6.3", | ||
"lint-staged": "^15.0.0", | ||
"nock": "^13.3.0", | ||
"npm-run-all2": "^5.0.0", | ||
"npm-run-all2": "^6.0.0", | ||
"prettier": "^2.2.1", | ||
"semantic-release": "^22.0.0", | ||
"semantic-release": "^23.0.0", | ||
"serverless": "^3.30.1", | ||
@@ -60,0 +60,0 @@ "ts-jest": "^26.5.0", |
# aws4-axios | ||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
@@ -20,2 +22,14 @@ | ||
# Compatibility | ||
This interceptor is heavily dependent on Axios internals, so minor changes to them can cause the interceptor to fail. | ||
Please make sure you are using one of the following versions of Axios before submitting issues etc. | ||
| Axios Version | Supported? | | ||
| ------------------- | ---------- | | ||
| `< 1.4.0` | ❌ No | | ||
| `>= 1.4.0 <= 1.6.7` | ✅ Yes | | ||
| `> 1.6.7` | Unknown | | ||
# Usage | ||
@@ -22,0 +36,0 @@ |
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
67877
1359
226