This commit is contained in:
Sergey Yarkov 2026-03-05 16:28:27 +03:00
parent dc951eda61
commit 5e6fad5bdf
2 changed files with 4 additions and 2 deletions

View File

@ -137,7 +137,7 @@ export default async (ctx) => {
sseClientCtx.res.sendSSEJson(parseResultCount, "done");
} catch (error) {
console.error(error);
sseClientCtx.res.sendSSEJson({ error: serializeError(error) }, "error");
sseClientCtx.res.sendSSEJson({ error: serializeError(error) }, "parseError");
} finally {
sseClientCtx.local.isParsing = false;
}

View File

@ -19,7 +19,9 @@ export async function routeHandler(url, ctxStorage, routeMap) {
if (url.pathname in routeMap) {
const route = routeMap[url.pathname];
if (route.method !== req.req.method) throw new MethodNotAllowedError();
if (route.method !== req.req.method) {
throw new MethodNotAllowedError();
}
if (req.req.headers["content-type"]?.includes("application/json")) {
ctx.data = await ctx.req.parseJson();