mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
fix(desktop): query parameters not working
This commit is contained in:
parent
03024ef7a9
commit
4def18e882
@ -3,6 +3,7 @@ import type { Application } from "express";
|
||||
import type { ParamsDictionary, Request, Response } from "express-serve-static-core";
|
||||
import type QueryString from "qs";
|
||||
import { Session, SessionData } from "express-session";
|
||||
import { parse as parseQuery } from "qs";
|
||||
import EventEmitter from "events";
|
||||
|
||||
type MockedResponse = Response<any, Record<string, any>, number>;
|
||||
@ -55,7 +56,7 @@ class FakeRequest extends EventEmitter implements Pick<Request<ParamsDictionary,
|
||||
body: any;
|
||||
headers: Record<string, string>;
|
||||
session: Session & Partial<SessionData>;
|
||||
query: Record<string, any> = {};
|
||||
query: Record<string, any>;
|
||||
|
||||
constructor(arg: Arg) {
|
||||
super();
|
||||
@ -64,6 +65,7 @@ class FakeRequest extends EventEmitter implements Pick<Request<ParamsDictionary,
|
||||
this.body = arg.data;
|
||||
this.headers = arg.headers;
|
||||
this.session = fakeSession;
|
||||
this.query = parseQuery(arg.url.split("?")[1] || "", { ignoreQueryPrefix: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user