@webqit/webflo 0.11.41 → 0.11.42
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/package.json
CHANGED
|
@@ -240,9 +240,9 @@ export default class Runtime extends _Runtime {
|
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
// ------------
|
|
243
|
-
let exit;
|
|
243
|
+
let exit, exitMessage;
|
|
244
244
|
if (!hosts.includes(url.hostname) && !hosts.includes('*')) {
|
|
245
|
-
exit = { status: 500,
|
|
245
|
+
exit = { status: 500 }, exitMessage = 'Unrecognized host';
|
|
246
246
|
} else if (url.protocol === 'http:' && this.cx.server.https.force) {
|
|
247
247
|
exit = { status: 302, headers: { Location: ( url.protocol = 'https:', url.href ) } };
|
|
248
248
|
} else if (url.hostname.startsWith('www.') && this.cx.server.force_www === 'remove') {
|
|
@@ -254,7 +254,7 @@ export default class Runtime extends _Runtime {
|
|
|
254
254
|
return _rdr || ((_rdr = pattern(entry.from, url.origin).exec(url.href)) && { status: entry.code || 302, headers: { Location: _rdr.render(entry.to) } });
|
|
255
255
|
}, null);
|
|
256
256
|
}
|
|
257
|
-
if (exit) { return new xResponse(
|
|
257
|
+
if (exit) { return new xResponse(exitMessage, exit); }
|
|
258
258
|
// ------------
|
|
259
259
|
|
|
260
260
|
// ------------
|
|
@@ -279,7 +279,7 @@ export default class Runtime extends _Runtime {
|
|
|
279
279
|
response = await this.app.handle(httpEvent, ( ...args ) => this.remoteFetch( ...args ));
|
|
280
280
|
finalResponse = await this.handleResponse(this.cx, httpEvent, response, autoHeaders.filter(header => header.type === 'response'));
|
|
281
281
|
} catch(e) {
|
|
282
|
-
finalResponse = new xResponse(
|
|
282
|
+
finalResponse = new xResponse(e.message, { status: 500 });
|
|
283
283
|
console.error(e);
|
|
284
284
|
}
|
|
285
285
|
// Logging
|
|
@@ -308,7 +308,7 @@ export default class Runtime extends _Runtime {
|
|
|
308
308
|
try {
|
|
309
309
|
response = await this.remoteFetch(url2, init2);
|
|
310
310
|
} catch(e) {
|
|
311
|
-
response = new xResponse(
|
|
311
|
+
response = new xResponse(e.message, { status: 500 });
|
|
312
312
|
console.error(e);
|
|
313
313
|
}
|
|
314
314
|
if (this.cx.logger) {
|
|
@@ -426,9 +426,10 @@ export default class Runtime extends _Runtime {
|
|
|
426
426
|
|
|
427
427
|
// ----------------
|
|
428
428
|
// 404
|
|
429
|
-
if (response.meta.body === undefined
|
|
430
|
-
|
|
431
|
-
|
|
429
|
+
if (response.meta.body === undefined) {
|
|
430
|
+
if (response.status === 200 || response.status === 0) {
|
|
431
|
+
response.attrs.status = 404;
|
|
432
|
+
}
|
|
432
433
|
return response;
|
|
433
434
|
}
|
|
434
435
|
|