-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): add error metadata indicating clock skew correction (#5830)
- Loading branch information
Showing
2 changed files
with
40 additions
and
8 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
packages/core/src/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { AwsSdkSigV4Signer } from "./AwsSdkSigV4Signer"; | ||
|
||
describe(AwsSdkSigV4Signer.name, () => { | ||
it("sets clockSkewCorrected metadata in error handler if systemClockOffset was updated", async () => { | ||
const signer = new AwsSdkSigV4Signer(); | ||
|
||
let error: Error | any; | ||
try { | ||
signer.errorHandler({ | ||
config: { | ||
systemClockOffset: 30 * 60 * 1000, | ||
}, | ||
})( | ||
Object.assign(new Error("uh oh"), { | ||
$metadata: {}, | ||
$response: { | ||
headers: { | ||
date: new Date().toISOString(), | ||
}, | ||
statusCode: 500, | ||
}, | ||
}) | ||
); | ||
} catch (e) { | ||
error = e as Error; | ||
} | ||
|
||
expect((error as any).$metadata.clockSkewCorrected).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters