@dooboostore/simple-boot-http-server 1.0.33 → 1.0.34
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/README.md +34 -0
- package/dist/cjs/SimpleBootHttpServer.js +23 -3
- package/dist/cjs/SimpleBootHttpServer.js.map +2 -2
- package/dist/esm/SimpleBootHttpServer.js +23 -3
- package/dist/esm/SimpleBootHttpServer.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +23 -3
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +2 -2
- package/dist/types/SimpleBootHttpServer.d.ts +8 -0
- package/dist/types/SimpleBootHttpServer.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +23 -3
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +2 -2
- package/package.json +10 -8
- package/src/SimpleBootHttpServer.ts +24 -3
|
@@ -10,6 +10,14 @@ export declare class SimpleBootHttpServer extends SimpleApplication {
|
|
|
10
10
|
private sessionManager;
|
|
11
11
|
private webSocketClients;
|
|
12
12
|
constructor(option?: HttpServerOption);
|
|
13
|
+
/**
|
|
14
|
+
* Final response flush that can never escape as an unhandled rejection.
|
|
15
|
+
* When the response is already gone (sent, closed, or destroyed mid-write),
|
|
16
|
+
* there is nobody left to send to, so gone-response write errors
|
|
17
|
+
* (ERR_HTTP_HEADERS_SENT, ERR_STREAM_ALREADY_FINISHED,
|
|
18
|
+
* ERR_STREAM_DESTROYED, ECONNRESET) are swallowed; anything else still throws.
|
|
19
|
+
*/
|
|
20
|
+
private safeResEnd;
|
|
13
21
|
run(otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>): this;
|
|
14
22
|
private startServer;
|
|
15
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleBootHttpServer.d.ts","sourceRoot":"","sources":["../../src/SimpleBootHttpServer.ts"],"names":[],"mappings":"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C,gBAAgB,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,CAAC;IAW5F,OAAO,CAAC,WAAW;CAmYpB"}
|
|
@@ -29482,6 +29482,26 @@ Content-Length: ${body.length}\r
|
|
|
29482
29482
|
this.webSocketClients = /* @__PURE__ */ new Map();
|
|
29483
29483
|
this.sessionManager = new SessionManager(this.option);
|
|
29484
29484
|
}
|
|
29485
|
+
/**
|
|
29486
|
+
* Final response flush that can never escape as an unhandled rejection.
|
|
29487
|
+
* When the response is already gone (sent, closed, or destroyed mid-write),
|
|
29488
|
+
* there is nobody left to send to, so gone-response write errors
|
|
29489
|
+
* (ERR_HTTP_HEADERS_SENT, ERR_STREAM_ALREADY_FINISHED,
|
|
29490
|
+
* ERR_STREAM_DESTROYED, ECONNRESET) are swallowed; anything else still throws.
|
|
29491
|
+
*/
|
|
29492
|
+
async safeResEnd(rr) {
|
|
29493
|
+
if (rr.resIsDone()) {
|
|
29494
|
+
return;
|
|
29495
|
+
}
|
|
29496
|
+
try {
|
|
29497
|
+
await rr.resEnd();
|
|
29498
|
+
} catch (e) {
|
|
29499
|
+
const code = e && (e.code || "");
|
|
29500
|
+
if (code !== "ERR_HTTP_HEADERS_SENT" && code !== "ERR_STREAM_ALREADY_FINISHED" && code !== "ERR_STREAM_DESTROYED" && code !== "ECONNRESET") {
|
|
29501
|
+
throw e;
|
|
29502
|
+
}
|
|
29503
|
+
}
|
|
29504
|
+
}
|
|
29485
29505
|
run(otherInstanceSim) {
|
|
29486
29506
|
otherInstanceSim ??= /* @__PURE__ */ new Map();
|
|
29487
29507
|
otherInstanceSim.set(_SimpleBootHttpServer, this);
|
|
@@ -29524,7 +29544,7 @@ Content-Length: ${body.length}\r
|
|
|
29524
29544
|
}
|
|
29525
29545
|
}
|
|
29526
29546
|
if (!rr.resIsDone()) {
|
|
29527
|
-
|
|
29547
|
+
await this.safeResEnd(rr);
|
|
29528
29548
|
}
|
|
29529
29549
|
});
|
|
29530
29550
|
res.on("error", async () => {
|
|
@@ -29541,7 +29561,7 @@ Content-Length: ${body.length}\r
|
|
|
29541
29561
|
}
|
|
29542
29562
|
}
|
|
29543
29563
|
if (!rr.resIsDone()) {
|
|
29544
|
-
|
|
29564
|
+
await this.safeResEnd(rr);
|
|
29545
29565
|
}
|
|
29546
29566
|
});
|
|
29547
29567
|
const rr = new RequestResponse(req, res, { sessionManager: this.sessionManager, option: this.option });
|
|
@@ -29796,7 +29816,7 @@ Content-Length: ${body.length}\r
|
|
|
29796
29816
|
transactionManager?.finally();
|
|
29797
29817
|
}
|
|
29798
29818
|
if (!rr.resIsDone()) {
|
|
29799
|
-
|
|
29819
|
+
await this.safeResEnd(rr);
|
|
29800
29820
|
}
|
|
29801
29821
|
});
|
|
29802
29822
|
if (this.option.webSocketEndPoints) {
|