@wooksjs/event-http 0.2.15 → 0.2.17
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/index.cjs +4 -3
- package/dist/index.mjs +4 -3
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -808,7 +808,7 @@ class HttpErrorRenderer extends BaseHttpResponseRenderer {
|
|
|
808
808
|
`<head><title>${data.statusCode} ${httpStatusCodes[data.statusCode]}</title></head>` +
|
|
809
809
|
`<body><center><h1>${data.statusCode} ${httpStatusCodes[data.statusCode]}</h1></center>` +
|
|
810
810
|
`<center><h4>${data.message}</h1></center><hr color="#666">` +
|
|
811
|
-
`<center style="color: #666;"> Wooks v${"0.2.
|
|
811
|
+
`<center style="color: #666;"> Wooks v${"0.2.17"} </center>` +
|
|
812
812
|
`${keys.length ? `<pre style="${preStyles}">${JSON.stringify(Object.assign(Object.assign({}, data), { statusCode: undefined, message: undefined, error: undefined }), null, ' ')}</pre>` : ''}` +
|
|
813
813
|
'</body></html>';
|
|
814
814
|
}
|
|
@@ -907,7 +907,7 @@ errorRenderer = new HttpErrorRenderer()) {
|
|
|
907
907
|
|
|
908
908
|
class WooksHttp extends wooks.WooksAdapterBase {
|
|
909
909
|
constructor(opts, wooks) {
|
|
910
|
-
super(wooks);
|
|
910
|
+
super(wooks, opts === null || opts === void 0 ? void 0 : opts.logger);
|
|
911
911
|
this.opts = opts;
|
|
912
912
|
this.responder = createWooksResponder();
|
|
913
913
|
this.logger = (opts === null || opts === void 0 ? void 0 : opts.logger) || this.getLogger('wooks-http');
|
|
@@ -971,7 +971,7 @@ class WooksHttp extends wooks.WooksAdapterBase {
|
|
|
971
971
|
getServerCb() {
|
|
972
972
|
return (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
973
973
|
var _a;
|
|
974
|
-
const { restoreCtx, clearCtx } = createHttpContext({ req, res }, ((_a = this.opts) === null || _a === void 0 ? void 0 : _a.eventOptions)
|
|
974
|
+
const { restoreCtx, clearCtx } = createHttpContext({ req, res }, this.mergeEventOptions((_a = this.opts) === null || _a === void 0 ? void 0 : _a.eventOptions));
|
|
975
975
|
const handlers = this.wooks.lookup(req.method, req.url);
|
|
976
976
|
if (handlers) {
|
|
977
977
|
try {
|
|
@@ -986,6 +986,7 @@ class WooksHttp extends wooks.WooksAdapterBase {
|
|
|
986
986
|
}
|
|
987
987
|
else {
|
|
988
988
|
// not found
|
|
989
|
+
this.logger.debug(`404 Not found (${req.method})${req.url}`);
|
|
989
990
|
this.respond(new HttpError(404));
|
|
990
991
|
clearCtx();
|
|
991
992
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -806,7 +806,7 @@ class HttpErrorRenderer extends BaseHttpResponseRenderer {
|
|
|
806
806
|
`<head><title>${data.statusCode} ${httpStatusCodes[data.statusCode]}</title></head>` +
|
|
807
807
|
`<body><center><h1>${data.statusCode} ${httpStatusCodes[data.statusCode]}</h1></center>` +
|
|
808
808
|
`<center><h4>${data.message}</h1></center><hr color="#666">` +
|
|
809
|
-
`<center style="color: #666;"> Wooks v${"0.2.
|
|
809
|
+
`<center style="color: #666;"> Wooks v${"0.2.17"} </center>` +
|
|
810
810
|
`${keys.length ? `<pre style="${preStyles}">${JSON.stringify(Object.assign(Object.assign({}, data), { statusCode: undefined, message: undefined, error: undefined }), null, ' ')}</pre>` : ''}` +
|
|
811
811
|
'</body></html>';
|
|
812
812
|
}
|
|
@@ -905,7 +905,7 @@ errorRenderer = new HttpErrorRenderer()) {
|
|
|
905
905
|
|
|
906
906
|
class WooksHttp extends WooksAdapterBase {
|
|
907
907
|
constructor(opts, wooks) {
|
|
908
|
-
super(wooks);
|
|
908
|
+
super(wooks, opts === null || opts === void 0 ? void 0 : opts.logger);
|
|
909
909
|
this.opts = opts;
|
|
910
910
|
this.responder = createWooksResponder();
|
|
911
911
|
this.logger = (opts === null || opts === void 0 ? void 0 : opts.logger) || this.getLogger('wooks-http');
|
|
@@ -969,7 +969,7 @@ class WooksHttp extends WooksAdapterBase {
|
|
|
969
969
|
getServerCb() {
|
|
970
970
|
return (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
971
971
|
var _a;
|
|
972
|
-
const { restoreCtx, clearCtx } = createHttpContext({ req, res }, ((_a = this.opts) === null || _a === void 0 ? void 0 : _a.eventOptions)
|
|
972
|
+
const { restoreCtx, clearCtx } = createHttpContext({ req, res }, this.mergeEventOptions((_a = this.opts) === null || _a === void 0 ? void 0 : _a.eventOptions));
|
|
973
973
|
const handlers = this.wooks.lookup(req.method, req.url);
|
|
974
974
|
if (handlers) {
|
|
975
975
|
try {
|
|
@@ -984,6 +984,7 @@ class WooksHttp extends WooksAdapterBase {
|
|
|
984
984
|
}
|
|
985
985
|
else {
|
|
986
986
|
// not found
|
|
987
|
+
this.logger.debug(`404 Not found (${req.method})${req.url}`);
|
|
987
988
|
this.respond(new HttpError(404));
|
|
988
989
|
clearCtx();
|
|
989
990
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/event-http",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"description": "@wooksjs/event-http",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"url": "https://github.com/wooksjs/wooksjs/issues"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"wooks": "0.2.
|
|
34
|
+
"wooks": "0.2.17",
|
|
35
35
|
"@prostojs/router": "^0.0.16",
|
|
36
|
-
"@wooksjs/event-core": "0.2.
|
|
36
|
+
"@wooksjs/event-core": "0.2.17"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@prostojs/logger": "^0.3.
|
|
39
|
+
"@prostojs/logger": "^0.3.4"
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/wooksjs/wooksjs/tree/main/packages/event-http#readme"
|
|
42
42
|
}
|