mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-29 20:36:43 -06:00
fix streaming query bug
This commit is contained in:
parent
a05f47d5cc
commit
f3640add23
1 changed files with 3 additions and 3 deletions
|
@ -3,13 +3,13 @@ import { EventEmitter } from 'eventemitter3';
|
||||||
import ReconnectingWebsocket from 'reconnecting-websocket';
|
import ReconnectingWebsocket from 'reconnecting-websocket';
|
||||||
import { BroadcastEvents, Channels } from './streaming.types';
|
import { BroadcastEvents, Channels } from './streaming.types';
|
||||||
|
|
||||||
export function urlQuery(obj: Record<string, unknown>): string {
|
export function urlQuery(obj: Record<string, string | number | boolean | undefined>): string {
|
||||||
const params = Object.entries(obj)
|
const params = Object.entries(obj)
|
||||||
.filter(([, v]) => Array.isArray(v) ? v.length : v !== undefined)
|
.filter(([, v]) => Array.isArray(v) ? v.length : v !== undefined)
|
||||||
.reduce((a, [k, v]) => (a[k] = v, a), {} as Record<string, unknown>);
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
|
.reduce((a, [k, v]) => (a[k] = v!, a), {} as Record<string, string | number | boolean>);
|
||||||
|
|
||||||
return Object.entries(params)
|
return Object.entries(params)
|
||||||
.map((e) => `${e[0]}=${e[1]}`)
|
|
||||||
.map((e) => `${e[0]}=${encodeURIComponent(e[1])}`)
|
.map((e) => `${e[0]}=${encodeURIComponent(e[1])}`)
|
||||||
.join('&');
|
.join('&');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue