@webqit/webflo 0.11.41 → 0.11.43-0
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
|
@@ -205,9 +205,12 @@ export async function webhook(httpEvent, router, next) {
|
|
|
205
205
|
new navigationEvent.Response(null, { status: exitCode === 0 ? 200 : 500 })
|
|
206
206
|
);
|
|
207
207
|
});
|
|
208
|
+
console.log(httpEvent.request.headers.get('x-github-delivery'));
|
|
209
|
+
console.log(httpEvent.request.headers.get('x-github-event'));
|
|
210
|
+
console.log(payload);
|
|
208
211
|
webhookEventHandler.receive({
|
|
209
212
|
id: httpEvent.request.headers.get('x-github-delivery'),
|
|
210
|
-
name: httpEvent.request.headers.get('x-github-
|
|
213
|
+
name: httpEvent.request.headers.get('x-github-event'),
|
|
211
214
|
payload: payload /* JSON object */,
|
|
212
215
|
});
|
|
213
216
|
});
|
|
@@ -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
|
|