tinny-backend 1.0.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Server.js +10 -14
- package/dist/utils/version.d.ts +1 -1
- package/dist/utils/version.js +1 -1
- package/package.json +1 -1
package/dist/core/Server.js
CHANGED
|
@@ -255,14 +255,6 @@ export default class Server {
|
|
|
255
255
|
}
|
|
256
256
|
Req.body = body;
|
|
257
257
|
body = "";
|
|
258
|
-
let handlersCount = 0;
|
|
259
|
-
for (const fun of this.golobalMidellWare) {
|
|
260
|
-
await fun.handler(req, res);
|
|
261
|
-
if (res.writableEnded) {
|
|
262
|
-
handlersCount++;
|
|
263
|
-
break;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
258
|
for (let i = 0; i < this.methodHandler.length; i++) {
|
|
267
259
|
const match = Req.ReqUrl?.pathname.match(this.methodHandler[i]?.regex ?? "");
|
|
268
260
|
if (this.methodHandler[i]?.method == req.method
|
|
@@ -271,24 +263,28 @@ export default class Server {
|
|
|
271
263
|
this.methodHandler[i]?.paramNames.forEach((name, index) => {
|
|
272
264
|
Req.params[name] = match[index + 1] || "";
|
|
273
265
|
});
|
|
274
|
-
if (!
|
|
266
|
+
if (!res.writableEnded) {
|
|
275
267
|
if (this.methodHandler[i]?.middelWares && typeof this.methodHandler[i]?.middelWares != "undefined") {
|
|
276
268
|
for (const middelware of this.methodHandler[i]?.middelWares ?? []) {
|
|
277
269
|
await middelware(Req, Res);
|
|
278
|
-
if (
|
|
270
|
+
if (res.writableEnded)
|
|
279
271
|
break;
|
|
280
272
|
}
|
|
281
273
|
}
|
|
282
|
-
if (!
|
|
274
|
+
if (!res.writableEnded)
|
|
283
275
|
await this.methodHandler[i]?.handler(req, res);
|
|
284
276
|
const nextFn = this.methodHandler[i]?.next;
|
|
285
|
-
if (typeof nextFn === "function")
|
|
277
|
+
if (typeof nextFn === "function" && !res.writableEnded)
|
|
286
278
|
await nextFn(Req, Res);
|
|
287
|
-
handlersCount++;
|
|
288
279
|
}
|
|
289
280
|
}
|
|
290
281
|
}
|
|
291
|
-
|
|
282
|
+
for (const fun of this.golobalMidellWare) {
|
|
283
|
+
if (res.writableEnded)
|
|
284
|
+
break;
|
|
285
|
+
await fun.handler(req, res);
|
|
286
|
+
}
|
|
287
|
+
if (!res.writableEnded) {
|
|
292
288
|
this.defaultHandler(Req, Res);
|
|
293
289
|
}
|
|
294
290
|
});
|
package/dist/utils/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.0
|
|
1
|
+
export declare const VERSION = "1.1.0";
|
package/dist/utils/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.0
|
|
1
|
+
export const VERSION = "1.1.0";
|