Closed robmoore closed 5 years ago
That's indeed a bug, that was missed in the automatic tests. Thanks for reporting it! I'll add a test case to cover for optional parameters. Should have a patch update by early next week.
I believe the correct behavior should be to check for greater or equal than the number of non-optional arguments.
And maybe the arity middleware could also be extended to accept an additional optional value for the maximum number of arguments, so that a more precise range or an exact number can still be enforced.
I'd like to pass a request to a function with definitely 1 and possibly 2 arguments. I tried making the second argument optional by assigning it a default argument but now I'm seeing an error stating that only one parameter is required and I passed two.