-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
21 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,25 +1,21 @@ | ||
export function generateLongQueryString(): string { | ||
const aaa = generateRandomString(512); | ||
const ddd = generateRandomString(512); | ||
const ccc = generateRandomString(256); | ||
const eee = generateRandomString(128); | ||
const ggg = generateRandomString(64); | ||
const hhh = generateRandomString(32); | ||
const aaa = repeatCharacter('A', 512); | ||
const ccc = repeatCharacter('C', 256); | ||
const ddd = repeatCharacter('D', 512); | ||
const eee = repeatCharacter('E', 256); | ||
const ggg = repeatCharacter('G', 128); | ||
const hhh = repeatCharacter('H', 64); | ||
|
||
return `T=Long` + | ||
`&T-AAA=${aaa}` + | ||
`&T-CCC=${ccc}` + | ||
`&T-DDD=${ddd}` + | ||
`&T-EEE=${eee}` + | ||
`&T-GGG=${ggg}` + | ||
`&T-HHH=${hhh}`; | ||
return `test=inline` + | ||
`&Test-Security-Token=${aaa}` + | ||
`&Test-Algorithm=${ccc}` + | ||
`&Test-Date=${ddd}` + | ||
`&Test-SignedHeaders=host` + | ||
`&Test-Expires=43200` + | ||
`&Test-Credential=${eee}` + | ||
`&Test-Signature=${ggg}`; | ||
} | ||
|
||
export function generateRandomString(length: number): string { | ||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | ||
let result = ''; | ||
for (let i = 0; i < length; i++) { | ||
result += chars.charAt(Math.floor(Math.random() * chars.length)); | ||
} | ||
return result; | ||
} | ||
export function repeatCharacter(char: string, length: number): string { | ||
return char.repeat(length); | ||
} |