Skip to content

Commit 1782623

Browse files
authored
Merge pull request #62 from Ilrilan/fix-url-search-params-parse
fix request id generation
2 parents 9a19838 + f3fb848 commit 1782623

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/request-id.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,11 @@ const getRequestId = (params: Params) => {
129129
queryBlacklist.forEach((param) => urlObj.searchParams.delete(param))
130130
let baseStr = urlObj.toString() + body
131131

132-
const entries = [...urlObj.searchParams]
133-
134-
const queryStr: string = entries.reduce((acc: string[], [key, value]) => {
135-
acc.push(`${key}-${value}`)
136-
137-
return acc
138-
}, []).join('-')
132+
const entries = []
133+
for (const [key, value] of urlObj.searchParams) {
134+
entries.push(`${key}-${value}`)
135+
}
136+
const queryStr: string = entries.join('-')
139137

140138
let queryStrAscii = queryStr.toLowerCase().replace(/[^a-z0-9-]/g, '')
141139

0 commit comments

Comments
 (0)