@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dooboostore/simple-boot-http-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -55,16 +55,18 @@
|
|
|
55
55
|
"SeoDH <adonis_84@naver.com> (https://github.com/SeoDH)",
|
|
56
56
|
"tkyung (https://github.com/tkyungDev)",
|
|
57
57
|
"Hoil-Gang (https://github.com/khl1154)",
|
|
58
|
-
"hwangsero (https://github.com/hwangsero)"
|
|
58
|
+
"hwangsero (https://github.com/hwangsero)",
|
|
59
|
+
"visualkhh <visualkhh@gmail.com> (https://github.com/visualkhh)"
|
|
59
60
|
],
|
|
60
|
-
"homepage": "https://github.
|
|
61
|
+
"homepage": "https://dooboostore-develop.github.io/package/simple-boot-http-server",
|
|
61
62
|
"bugs": {
|
|
62
|
-
"url": "https://github.com/dooboostore-develop/packages",
|
|
63
|
+
"url": "https://github.com/dooboostore-develop/packages/issues",
|
|
63
64
|
"email": "dooboostore@gmail.com"
|
|
64
65
|
},
|
|
65
66
|
"repository": {
|
|
66
67
|
"type": "git",
|
|
67
|
-
"url": "https://github.com/dooboostore-develop/packages"
|
|
68
|
+
"url": "git+https://github.com/dooboostore-develop/packages.git",
|
|
69
|
+
"directory": "packages/@dooboostore/simple-boot-http-server"
|
|
68
70
|
},
|
|
69
71
|
"peerDependencies": {
|
|
70
72
|
"reflect-metadata": "^0.2.2"
|
|
@@ -99,10 +101,10 @@
|
|
|
99
101
|
"node-gzip": "^1.1.2",
|
|
100
102
|
"ws": "^8.18.3",
|
|
101
103
|
"@dooboostore/core": "1.0.33",
|
|
102
|
-
"@dooboostore/dom-render": "1.0.115",
|
|
103
|
-
"@dooboostore/core-node": "1.0.14",
|
|
104
104
|
"@dooboostore/core-web": "1.0.14",
|
|
105
|
-
"@dooboostore/simple-boot": "1.0.60"
|
|
105
|
+
"@dooboostore/simple-boot": "1.0.60",
|
|
106
|
+
"@dooboostore/dom-render": "1.0.115",
|
|
107
|
+
"@dooboostore/core-node": "1.0.14"
|
|
106
108
|
},
|
|
107
109
|
"scripts": {
|
|
108
110
|
"clean": "rm -rf dist",
|
|
@@ -44,6 +44,27 @@ export class SimpleBootHttpServer extends SimpleApplication {
|
|
|
44
44
|
this.sessionManager = new SessionManager(this.option);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Final response flush that can never escape as an unhandled rejection.
|
|
49
|
+
* When the response is already gone (sent, closed, or destroyed mid-write),
|
|
50
|
+
* there is nobody left to send to, so gone-response write errors
|
|
51
|
+
* (ERR_HTTP_HEADERS_SENT, ERR_STREAM_ALREADY_FINISHED,
|
|
52
|
+
* ERR_STREAM_DESTROYED, ECONNRESET) are swallowed; anything else still throws.
|
|
53
|
+
*/
|
|
54
|
+
private async safeResEnd(rr: RequestResponse): Promise<void> {
|
|
55
|
+
if (rr.resIsDone()) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
await rr.resEnd();
|
|
60
|
+
} catch (e: any) {
|
|
61
|
+
const code = e && (e.code || '');
|
|
62
|
+
if (code !== 'ERR_HTTP_HEADERS_SENT' && code !== 'ERR_STREAM_ALREADY_FINISHED' && code !== 'ERR_STREAM_DESTROYED' && code !== 'ECONNRESET') {
|
|
63
|
+
throw e;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
47
68
|
|
|
48
69
|
public run(otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>) {
|
|
49
70
|
otherInstanceSim ??= new Map<ConstructorType<any> | Function | SimConfig | symbol, any>();
|
|
@@ -95,7 +116,7 @@ export class SimpleBootHttpServer extends SimpleApplication {
|
|
|
95
116
|
}
|
|
96
117
|
|
|
97
118
|
if (!rr.resIsDone()) {
|
|
98
|
-
|
|
119
|
+
await this.safeResEnd(rr);
|
|
99
120
|
}
|
|
100
121
|
});
|
|
101
122
|
res.on('error', async () => {
|
|
@@ -113,7 +134,7 @@ export class SimpleBootHttpServer extends SimpleApplication {
|
|
|
113
134
|
}
|
|
114
135
|
|
|
115
136
|
if (!rr.resIsDone()) {
|
|
116
|
-
|
|
137
|
+
await this.safeResEnd(rr);
|
|
117
138
|
}
|
|
118
139
|
});
|
|
119
140
|
|
|
@@ -419,7 +440,7 @@ export class SimpleBootHttpServer extends SimpleApplication {
|
|
|
419
440
|
}
|
|
420
441
|
|
|
421
442
|
if (!rr.resIsDone()) {
|
|
422
|
-
|
|
443
|
+
await this.safeResEnd(rr);
|
|
423
444
|
}
|
|
424
445
|
});
|
|
425
446
|
|