From bd9df789d18fe51e4224a93cc2ed814729a97b92 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 1 Oct 2021 00:31:43 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20prelude/url=E3=81=A7querystring?= =?UTF-8?q?=E3=82=92=E4=BD=BF=E7=94=A8=E3=81=97=E3=81=AA=E3=81=84=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolve #7854 --- src/prelude/url.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/prelude/url.ts b/src/prelude/url.ts index a3613fc9b9..ce75fe89d1 100644 --- a/src/prelude/url.ts +++ b/src/prelude/url.ts @@ -1,9 +1,11 @@ -import { stringify } from 'querystring'; - export function query(obj: {}): string { - return stringify(Object.entries(obj) + const params = Object.entries(obj) .filter(([, v]) => Array.isArray(v) ? v.length : v !== undefined) - .reduce((a, [k, v]) => (a[k] = v, a), {} as Record)); + .reduce((a, [k, v]) => (a[k] = v, a), {} as Record); + + return Object.entries(params) + .map((e) => `${e[0]}=${e[1]}`) + .join('&'); } export function appendQuery(url: string, query: string): string {