@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
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "0.11.41",
15
+ "version": "0.11.42",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -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, statusText: 'Unrecognized host' };
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(null, exit); }
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(null, { status: 500, statusText: e.message });
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(null, { status: 500, statusText: e.message });
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 || response.meta.body === null) {
430
- response.attrs.status = response.status !== 200 ? response.status : 404;
431
- response.attrs.statusText = `${e.request.url} not found!`;
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