Fix endpoint support
This commit is contained in:
parent
ccb7f9e6f6
commit
5bbd099bdd
@ -49,8 +49,8 @@ export class EndpointHook implements Hook<EndpointHookT> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const functions = manifest.functions;
|
const functions = manifest.functions;
|
||||||
console.log("Checking plug", plugName);
|
// console.log("Checking plug", plugName);
|
||||||
const prefix = `${this.prefix}/${plugName}`;
|
const prefix = `${this.prefix}${plugName}`;
|
||||||
if (!requestPath.startsWith(prefix)) {
|
if (!requestPath.startsWith(prefix)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -58,11 +58,11 @@ export class EndpointHook implements Hook<EndpointHookT> {
|
|||||||
if (!functionDef.http) {
|
if (!functionDef.http) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
console.log("Got config", functionDef);
|
// console.log("Got config", functionDef);
|
||||||
const endpoints = Array.isArray(functionDef.http)
|
const endpoints = Array.isArray(functionDef.http)
|
||||||
? functionDef.http
|
? functionDef.http
|
||||||
: [functionDef.http];
|
: [functionDef.http];
|
||||||
console.log(endpoints);
|
// console.log(endpoints);
|
||||||
for (const { path, method } of endpoints) {
|
for (const { path, method } of endpoints) {
|
||||||
const prefixedPath = `${prefix}${path}`;
|
const prefixedPath = `${prefix}${path}`;
|
||||||
if (
|
if (
|
||||||
@ -92,7 +92,7 @@ export class EndpointHook implements Hook<EndpointHookT> {
|
|||||||
}
|
}
|
||||||
ctx.response.status = response.status;
|
ctx.response.status = response.status;
|
||||||
ctx.response.body = response.body;
|
ctx.response.body = response.body;
|
||||||
console.log("Sent result");
|
// console.log("Sent result");
|
||||||
return;
|
return;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error("Error executing function", e);
|
console.error("Error executing function", e);
|
||||||
|
Loading…
Reference in New Issue
Block a user