Skip to content

Commit

Permalink
fix: linting issues (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfloyd authored Feb 13, 2025
1 parent d558320 commit c346f5c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/request-error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe("RequestError", () => {
bar: "baz",
},
headers: {
authorization: ""+" ".repeat(100000)+"\n@",
authorization: "" + " ".repeat(100000) + "\n@",
},
},
response: {
Expand All @@ -43,11 +43,13 @@ describe("RequestError", () => {
});
const endTime = performance.now();
const elapsedTime = endTime - startTime;
const reDosThreshold = 2000;
const reDosThreshold = 2000;

expect(elapsedTime).toBeLessThanOrEqual(reDosThreshold);
if (elapsedTime > reDosThreshold) {
console.warn(`🚨 Potential ReDoS Attack! getDuration method took ${elapsedTime.toFixed(2)} ms, exceeding threshold of ${reDosThreshold} ms.`);
console.warn(
`🚨 Potential ReDoS Attack! getDuration method took ${elapsedTime.toFixed(2)} ms, exceeding threshold of ${reDosThreshold} ms.`,
);
}
});

Expand Down

0 comments on commit c346f5c

Please sign in to comment.