Skip to content

Commit

Permalink
fix: warn user upon wrong telefunc() usage
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Feb 13, 2022
1 parent e08b1e9 commit e0a5987
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions telefunc/node/server/telefunc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@ function assertHttpRequest(httpRequest: unknown, numberOfArguments: number) {
assertUsage(hasProp(httpRequest, 'method'), '`telefunc({ method })`: argument `method` is missing.')
assertUsage(hasProp(httpRequest, 'method', 'string'), '`telefunc({ method })`: argument `method` should be a string.')
assertUsage(hasProp(httpRequest, 'body'), '`telefunc({ body })`: argument `body` is missing.')
Object.keys(httpRequest).forEach((key) => {
assertUsage(['url', 'method', 'body'].includes(key), '`telefunc({ ' + key + ' })`: Unknown argument `' + key + '`.')
})
// We further assert the `httpRequest` in `./runTelefunc/parseHttpRequest.ts`
}

0 comments on commit e0a5987

Please sign in to comment.