@adaas/a-server 0.0.25 → 0.0.26
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/browser/index.mjs +15 -3
- package/dist/browser/index.mjs.map +1 -1
- package/dist/node/lib/A-Response/A-Response.entity.js +5 -3
- package/dist/node/lib/A-Response/A-Response.entity.js.map +1 -1
- package/dist/node/lib/A-Response/A-Response.entity.mjs +5 -3
- package/dist/node/lib/A-Response/A-Response.entity.mjs.map +1 -1
- package/dist/node/lib/A-Server/A-HttpServer.container.js +10 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.js.map +1 -1
- package/dist/node/lib/A-Server/A-HttpServer.container.mjs +10 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/A-Response/A-Response.entity.ts +14 -3
- package/src/lib/A-Server/A-HttpServer.container.ts +11 -0
package/dist/browser/index.mjs
CHANGED
|
@@ -1195,10 +1195,12 @@ var A_Response = class extends A_Entity {
|
|
|
1195
1195
|
* Destroy the response
|
|
1196
1196
|
*/
|
|
1197
1197
|
async destroy() {
|
|
1198
|
-
if (!this.
|
|
1199
|
-
this.original.
|
|
1198
|
+
if (!this._isStreaming) {
|
|
1199
|
+
if (!this.original.writableEnded) {
|
|
1200
|
+
this.original.end();
|
|
1201
|
+
}
|
|
1200
1202
|
this._listeners.clear();
|
|
1201
|
-
this.original.removeAllListeners();
|
|
1203
|
+
this.original.removeAllListeners("error");
|
|
1202
1204
|
}
|
|
1203
1205
|
return super.destroy();
|
|
1204
1206
|
}
|
|
@@ -1902,6 +1904,16 @@ var A_HttpServer = class extends A_Service {
|
|
|
1902
1904
|
case (error instanceof A_Error && error.originalError instanceof A_HttpServerError):
|
|
1903
1905
|
wrappedError = error.originalError;
|
|
1904
1906
|
break;
|
|
1907
|
+
// Duck-type: any Error with a numeric statusCode property (e.g. http-errors,
|
|
1908
|
+
// Express-style errors, or plain project HttpError classes). Honour the
|
|
1909
|
+
// status code so the caller gets the right 4xx / 5xx rather than a blanket 500.
|
|
1910
|
+
case (error instanceof Error && typeof error.statusCode === "number"):
|
|
1911
|
+
wrappedError = new A_HttpServerError({
|
|
1912
|
+
status: error.statusCode,
|
|
1913
|
+
description: error.message,
|
|
1914
|
+
originalError: error
|
|
1915
|
+
});
|
|
1916
|
+
break;
|
|
1905
1917
|
default:
|
|
1906
1918
|
wrappedError = new A_HttpServerError({
|
|
1907
1919
|
status: 500,
|