Skip to content

Commit

Permalink
fix:query param format
Browse files Browse the repository at this point in the history
查询参数传入null或undefined时会将其转为字符串,而不是删除

Signed-off-by: 徐家铭 <alibi_jia@foxmail.com>
  • Loading branch information
superAlibi authored and gitee-org committed Jul 18, 2024
1 parent 3032d9e commit eb681e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libs/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ export class Fetcher extends SyncEventDispatcher<{
if (params instanceof URLSearchParams) {
urlObj.search = params.toString();
} else {
urlObj.search = new URLSearchParams(params).toString();
const formatedQuery=Object.fromEntries(
Object.entries(params).filter(([key, value]) => value !== undefined && value !== null)
)
urlObj.search = new URLSearchParams(formatedQuery).toString();
}
}
const { headers } = otherCustomConfig || {}
Expand Down

0 comments on commit eb681e7

Please sign in to comment.