fix: missing ctx on after hooks

This commit is contained in:
Bereket Engida
2024-11-11 20:57:25 +03:00
parent 6c4c482dbf
commit 1751cd127d

View File

@@ -201,13 +201,14 @@ export function getEndpoints<
for (const plugin of options.plugins || []) {
if (plugin.hooks?.after) {
for (const hook of plugin.hooks.after) {
// @ts-expect-error - returned is not in the context type
c.returned = response;
// @ts-expect-error - endpoint is not in the context type
c.endpoint = value;
const ctx = {
...context,
context: c,
context: {
...c,
...context.context,
endpoint: value,
returned: response,
},
};
const match = hook.matcher(ctx);
if (match) {