Skip to content

Commit

Permalink
perf(core): request 模块的 gm http 的 data 使用 JSON.stringify 进行转换
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Dec 4, 2023
1 parent 9992a03 commit 7d4f660
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/core/utils/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function request<T extends 'json' | 'text'>(
GM_xmlhttpRequest({
url,
method: method.toUpperCase() as 'GET' | 'HEAD' | 'POST',
data: Object.keys(data).length ? new URLSearchParams(data).toString() : undefined,
data: Object.keys(data).length ? JSON.stringify(data) : undefined,
headers: Object.keys(headers).length ? headers : undefined,
responseType: responseType === 'json' ? 'json' : undefined,
onload: (response) => {
Expand Down

0 comments on commit 7d4f660

Please sign in to comment.