@aws-sdk/node-http-handler
Advanced tools
Comparing version 3.58.0 to 3.74.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.74.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.73.0...v3.74.0) (2022-04-20) | ||
### Bug Fixes | ||
* **node-http-handler:** resolve config provider only once per NodeHttpHandler instance ([#3545](https://github.com/aws/aws-sdk-js-v3/issues/3545)) ([8ffd6b2](https://github.com/aws/aws-sdk-js-v3/commit/8ffd6b2e3e488f9827a98c970cd6901e2a3fbe93)) | ||
# [3.58.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.57.0...v3.58.0) (2022-03-28) | ||
@@ -8,0 +19,0 @@ |
@@ -16,10 +16,14 @@ "use strict"; | ||
this.metadata = { handlerProtocol: "http/1.1" }; | ||
if (typeof options === "function") { | ||
this.configProvider = async () => { | ||
return this.resolveDefaultConfig(await options()); | ||
}; | ||
} | ||
else { | ||
this.config = this.resolveDefaultConfig(options); | ||
} | ||
this.configProvider = new Promise((resolve, reject) => { | ||
if (typeof options === "function") { | ||
options() | ||
.then((_options) => { | ||
resolve(this.resolveDefaultConfig(_options)); | ||
}) | ||
.catch(reject); | ||
} | ||
else { | ||
resolve(this.resolveDefaultConfig(options)); | ||
} | ||
}); | ||
} | ||
@@ -43,4 +47,4 @@ resolveDefaultConfig(options) { | ||
async handle(request, { abortSignal } = {}) { | ||
if (!this.config && this.configProvider) { | ||
this.config = await this.configProvider(); | ||
if (!this.config) { | ||
this.config = await this.configProvider; | ||
} | ||
@@ -47,0 +51,0 @@ return new Promise((resolve, reject) => { |
@@ -15,18 +15,14 @@ import { __awaiter, __generator } from "tslib"; | ||
this.metadata = { handlerProtocol: "http/1.1" }; | ||
if (typeof options === "function") { | ||
this.configProvider = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var _a; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = this.resolveDefaultConfig; | ||
return [4, options()]; | ||
case 1: return [2, _a.apply(this, [_b.sent()])]; | ||
} | ||
}); | ||
}); }; | ||
} | ||
else { | ||
this.config = this.resolveDefaultConfig(options); | ||
} | ||
this.configProvider = new Promise(function (resolve, reject) { | ||
if (typeof options === "function") { | ||
options() | ||
.then(function (_options) { | ||
resolve(_this.resolveDefaultConfig(_options)); | ||
}) | ||
.catch(reject); | ||
} | ||
else { | ||
resolve(_this.resolveDefaultConfig(options)); | ||
} | ||
}); | ||
} | ||
@@ -57,5 +53,5 @@ NodeHttpHandler.prototype.resolveDefaultConfig = function (options) { | ||
case 0: | ||
if (!(!this.config && this.configProvider)) return [3, 2]; | ||
if (!!this.config) return [3, 2]; | ||
_c = this; | ||
return [4, this.configProvider()]; | ||
return [4, this.configProvider]; | ||
case 1: | ||
@@ -62,0 +58,0 @@ _c.config = _d.sent(); |
@@ -25,3 +25,3 @@ /// <reference types="node" /> | ||
private config?; | ||
private readonly configProvider?; | ||
private readonly configProvider; | ||
readonly metadata: { | ||
@@ -28,0 +28,0 @@ handlerProtocol: string; |
@@ -17,3 +17,3 @@ | ||
private config?; | ||
private readonly configProvider?; | ||
private readonly configProvider; | ||
readonly metadata: { | ||
@@ -20,0 +20,0 @@ handlerProtocol: string; |
{ | ||
"name": "@aws-sdk/node-http-handler", | ||
"version": "3.58.0", | ||
"version": "3.74.0", | ||
"description": "Provides a way to make requests", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
114242