aws4-axios
Advanced tools
Comparing version 1.9.2 to 1.10.0
@@ -24,4 +24,9 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var aws4_1 = require("aws4"); | ||
var combineURLs_1 = __importDefault(require("axios/lib/helpers/combineURLs")); | ||
var isAbsoluteURL_1 = __importDefault(require("axios/lib/helpers/isAbsoluteURL")); | ||
var url_1 = require("url"); | ||
@@ -43,3 +48,7 @@ /** | ||
} | ||
var _a = new url_1.URL(config.url), host = _a.host, pathname = _a.pathname, search = _a.search; | ||
var url = config.url; | ||
if (config.baseURL && !isAbsoluteURL_1.default(config.url)) { | ||
url = combineURLs_1.default(config.baseURL, config.url); | ||
} | ||
var _a = new url_1.URL(url), host = _a.host, pathname = _a.pathname, search = _a.search; | ||
var data = config.data, headers = config.headers, method = config.method; | ||
@@ -46,0 +55,0 @@ var region; |
@@ -164,2 +164,30 @@ "use strict"; | ||
}); | ||
it("works with baseURL config", function () { | ||
// Arrange | ||
var data = "foobar"; | ||
var request = { | ||
method: "POST", | ||
baseURL: "https://example.com/foo", | ||
url: "bar", | ||
data: data, | ||
headers: __assign({}, getDefaultHeaders(), { "Content-Type": "application/xml" }), | ||
transformRequest: getDefaultTransformRequest() | ||
}; | ||
var interceptor = _1.aws4Interceptor({ | ||
region: "local", | ||
service: "execute-api" | ||
}); | ||
// Act | ||
interceptor(request); | ||
// Assert | ||
expect(aws4_1.sign).toBeCalledWith({ | ||
service: "execute-api", | ||
method: "POST", | ||
path: "/foo/bar", | ||
region: "local", | ||
host: "example.com", | ||
body: "foobar", | ||
headers: { "Content-Type": "application/xml" } | ||
}); | ||
}); | ||
}); |
{ | ||
"name": "aws4-axios", | ||
"version": "1.9.2", | ||
"version": "1.10.0", | ||
"description": "Axios request interceptor for signing requests with AWSv4", | ||
@@ -22,2 +22,7 @@ "author": "James Bourne", | ||
], | ||
"resolutions": { | ||
"lodash": "4.17.15", | ||
"mixin-deep": "2.0.1", | ||
"set-value": "3.0.1" | ||
}, | ||
"main": "dist/index.js", | ||
@@ -32,6 +37,6 @@ "types": "dist/index.d.ts", | ||
"devDependencies": { | ||
"@types/jest": "^24.0.13", | ||
"@types/jest": "^24.0.15", | ||
"@types/moxios": "^0.4.8", | ||
"@types/node": "^12.0.4", | ||
"eslint": "^5.16.0", | ||
"@types/node": "^12.6.8", | ||
"eslint": "^6.1.0", | ||
"jest": "^24.8.0", | ||
@@ -41,3 +46,3 @@ "jest-junit": "^6.4.0", | ||
"ts-jest": "^24.0.2", | ||
"typescript": "^3.5.1" | ||
"typescript": "^3.5.3" | ||
}, | ||
@@ -44,0 +49,0 @@ "dependencies": { |
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
38017
823