@smithy/node-http-handler
Advanced tools
Comparing version 3.3.1 to 3.3.2
@@ -61,4 +61,4 @@ var __create = Object.create; | ||
var timing = { | ||
setTimeout, | ||
clearTimeout | ||
setTimeout: (cb, ms) => setTimeout(cb, ms), | ||
clearTimeout: (timeoutId) => clearTimeout(timeoutId) | ||
}; | ||
@@ -151,5 +151,5 @@ | ||
let timeoutId = -1; | ||
let hasError = false; | ||
let sendBody = true; | ||
if (expect === "100-continue") { | ||
await Promise.race([ | ||
sendBody = await Promise.race([ | ||
new Promise((resolve) => { | ||
@@ -161,8 +161,11 @@ timeoutId = Number(timing.setTimeout(resolve, Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs))); | ||
timing.clearTimeout(timeoutId); | ||
resolve(); | ||
resolve(true); | ||
}); | ||
httpRequest.on("response", () => { | ||
timing.clearTimeout(timeoutId); | ||
resolve(false); | ||
}); | ||
httpRequest.on("error", () => { | ||
hasError = true; | ||
timing.clearTimeout(timeoutId); | ||
resolve(); | ||
resolve(false); | ||
}); | ||
@@ -172,3 +175,3 @@ }) | ||
} | ||
if (!hasError) { | ||
if (sendBody) { | ||
writeBody(httpRequest, request.body); | ||
@@ -175,0 +178,0 @@ } |
export const timing = { | ||
setTimeout: setTimeout, | ||
clearTimeout: clearTimeout, | ||
setTimeout: (cb, ms) => setTimeout(cb, ms), | ||
clearTimeout: (timeoutId) => clearTimeout(timeoutId), | ||
}; |
@@ -8,5 +8,5 @@ import { Readable } from "stream"; | ||
let timeoutId = -1; | ||
let hasError = false; | ||
let sendBody = true; | ||
if (expect === "100-continue") { | ||
await Promise.race([ | ||
sendBody = await Promise.race([ | ||
new Promise((resolve) => { | ||
@@ -18,8 +18,11 @@ timeoutId = Number(timing.setTimeout(resolve, Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs))); | ||
timing.clearTimeout(timeoutId); | ||
resolve(); | ||
resolve(true); | ||
}); | ||
httpRequest.on("response", () => { | ||
timing.clearTimeout(timeoutId); | ||
resolve(false); | ||
}); | ||
httpRequest.on("error", () => { | ||
hasError = true; | ||
timing.clearTimeout(timeoutId); | ||
resolve(); | ||
resolve(false); | ||
}); | ||
@@ -29,3 +32,3 @@ }), | ||
} | ||
if (!hasError) { | ||
if (sendBody) { | ||
writeBody(httpRequest, request.body); | ||
@@ -32,0 +35,0 @@ } |
@@ -6,4 +6,4 @@ /** | ||
export declare const timing: { | ||
setTimeout: typeof setTimeout; | ||
clearTimeout: typeof clearTimeout; | ||
setTimeout: (cb: (...ignored: any[]) => void | unknown, ms?: number) => number; | ||
clearTimeout: (timeoutId: string | number | undefined | unknown) => void; | ||
}; |
@@ -6,4 +6,4 @@ /** | ||
export declare const timing: { | ||
setTimeout: typeof setTimeout; | ||
clearTimeout: typeof clearTimeout; | ||
setTimeout: (cb: (...ignored: any[]) => void | unknown, ms?: number) => number; | ||
clearTimeout: (timeoutId: string | number | undefined | unknown) => void; | ||
}; |
{ | ||
"name": "@smithy/node-http-handler", | ||
"version": "3.3.1", | ||
"version": "3.3.2", | ||
"description": "Provides a way to make requests", | ||
@@ -29,6 +29,6 @@ "scripts": { | ||
"dependencies": { | ||
"@smithy/abort-controller": "^3.1.8", | ||
"@smithy/protocol-http": "^4.1.7", | ||
"@smithy/querystring-builder": "^3.0.10", | ||
"@smithy/types": "^3.7.1", | ||
"@smithy/abort-controller": "^3.1.9", | ||
"@smithy/protocol-http": "^4.1.8", | ||
"@smithy/querystring-builder": "^3.0.11", | ||
"@smithy/types": "^3.7.2", | ||
"tslib": "^2.6.2" | ||
@@ -35,0 +35,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
94896
2052