This commit is contained in:
熊潇 2025-02-26 12:33:34 +08:00
parent 1c3e65df8a
commit de3187f5f3
2 changed files with 3 additions and 3 deletions

View File

@ -472,7 +472,7 @@ export class QueryRouter {
ctx.body = null; ctx.body = null;
return ctx; return ctx;
} }
ctx.query = ctx.nextQuery; ctx.query = { ...ctx.query, ...ctx.nextQuery };
ctx.nextQuery = {}; ctx.nextQuery = {};
return await this.runRoute(path, key, ctx); return await this.runRoute(path, key, ctx);
} }
@ -497,7 +497,7 @@ export class QueryRouter {
*/ */
async parse(message: { path: string; key?: string; payload?: any }, ctx?: RouteContext & { [key: string]: any }) { async parse(message: { path: string; key?: string; payload?: any }, ctx?: RouteContext & { [key: string]: any }) {
if (!message?.path) { if (!message?.path) {
return Promise.resolve({ code: 404, body: 'Not found path' }); return Promise.resolve({ code: 404, body: null, message: 'Not found path' });
} }
const { path, key = '', payload = {}, ...query } = message; const { path, key = '', payload = {}, ...query } = message;
ctx = ctx || {}; ctx = ctx || {};

View File

@ -24,7 +24,7 @@ export const handleServer = async (req: IncomingMessage, res: ServerResponse) =>
const handle = createHandleCtx(req, res); const handle = createHandleCtx(req, res);
const cookies = handle.req.cookies; const cookies = handle.req.cookies;
if (!token) { if (!token) {
token = cookies.token; token = cookies.token; // cookie优先
} }
if (token) { if (token) {
token = token.replace('Bearer ', ''); token = token.replace('Bearer ', '');