@adaas/a-server 0.0.25 → 0.0.27
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 +25 -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 +20 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.js.map +1 -1
- package/dist/node/lib/A-Server/A-HttpServer.container.mjs +20 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.mjs.map +1 -1
- package/package.json +3 -3
- package/src/lib/A-Response/A-Response.entity.ts +14 -3
- package/src/lib/A-Server/A-HttpServer.container.ts +24 -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,26 @@ 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: A_Error (e.g. A_FeatureError) wrapping an HttpError-like original.
|
|
1908
|
+
// A_Error.fromConstructor() unwraps nested A_Error chains, so originalError is
|
|
1909
|
+
// always the root non-A_Error cause — check it for a numeric statusCode.
|
|
1910
|
+
case (error instanceof A_Error && error.originalError instanceof Error && typeof error.originalError.statusCode === "number"):
|
|
1911
|
+
wrappedError = new A_HttpServerError({
|
|
1912
|
+
status: error.originalError.statusCode,
|
|
1913
|
+
description: error.originalError.message,
|
|
1914
|
+
originalError: error.originalError
|
|
1915
|
+
});
|
|
1916
|
+
break;
|
|
1917
|
+
// Duck-type: any Error with a numeric statusCode property (e.g. http-errors,
|
|
1918
|
+
// Express-style errors, or plain project HttpError classes). Honour the
|
|
1919
|
+
// status code so the caller gets the right 4xx / 5xx rather than a blanket 500.
|
|
1920
|
+
case (error instanceof Error && typeof error.statusCode === "number"):
|
|
1921
|
+
wrappedError = new A_HttpServerError({
|
|
1922
|
+
status: error.statusCode,
|
|
1923
|
+
description: error.message,
|
|
1924
|
+
originalError: error
|
|
1925
|
+
});
|
|
1926
|
+
break;
|
|
1905
1927
|
default:
|
|
1906
1928
|
wrappedError = new A_HttpServerError({
|
|
1907
1929
|
status: 500,
|