Skip to content

Commit

Permalink
fix(core): Do not throw missing method error for regular hook methods (
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl authored May 17, 2022
1 parent 06d03e9 commit afe9a3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/feathers/src/hooks/regular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const createMap = (input: RegularHookMap<any, any>, methods: string[]) => {
const data = convertHookData(input[type]);

Object.keys(data).forEach((method) => {
if (method !== 'all' && !methods.includes(method)) {
if (method !== 'all' && !methods.includes(method) && !defaultServiceMethods.includes(method)) {
throw new Error(`'${method}' is not a valid hook method`);
}
});
Expand Down
4 changes: 3 additions & 1 deletion packages/feathers/test/hooks/before.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ describe('`before` hooks', () => {
return new Promise((_resolve, reject) => {
reject(new Error('This did not work'));
});
}
},

find: []
}
});

Expand Down

0 comments on commit afe9a3b

Please # to comment.