mirror of
https://github.com/sergeyyarkov/asu_tools_service.git
synced 2026-10-11 02:19:09 +03:00
upd
This commit is contained in:
parent
dc951eda61
commit
5e6fad5bdf
@ -137,7 +137,7 @@ export default async (ctx) => {
|
|||||||
sseClientCtx.res.sendSSEJson(parseResultCount, "done");
|
sseClientCtx.res.sendSSEJson(parseResultCount, "done");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
sseClientCtx.res.sendSSEJson({ error: serializeError(error) }, "error");
|
sseClientCtx.res.sendSSEJson({ error: serializeError(error) }, "parseError");
|
||||||
} finally {
|
} finally {
|
||||||
sseClientCtx.local.isParsing = false;
|
sseClientCtx.local.isParsing = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,9 @@ export async function routeHandler(url, ctxStorage, routeMap) {
|
|||||||
if (url.pathname in routeMap) {
|
if (url.pathname in routeMap) {
|
||||||
const route = routeMap[url.pathname];
|
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")) {
|
if (req.req.headers["content-type"]?.includes("application/json")) {
|
||||||
ctx.data = await ctx.req.parseJson();
|
ctx.data = await ctx.req.parseJson();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user