You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems JavaScript is cool with passing params to a funtion that doesnt take any. It'll simply just ignore them and call the function. The server should probably handle throwing the error.
ex.
const test = () => 'I dont take params'
> test('param')
> 'I dont take params'
Additionally, since JavaScript uses {} and [] to spread out the parameters, the server wont error if a list argument is passed to an object argument. It will just return undefined for those params. So this should error out as well (I think).
I wonder if this should just be on the user. The solution here shows that a user could just check the types in the method and throw an error if they are invalid, which would get passed along. In this case the user would throw a TypeError to return an Invalid Params response.
Perhaps the library should only throw an error if a user passes params to a function that doesnt accept any, or if an object arg is passed to an array arg and vice versa. Checking the arg types are correct should be the part of the user per the comment above.
It seems JavaScript is cool with passing params to a funtion that doesnt take any. It'll simply just ignore them and call the function. The server should probably handle throwing the error.
ex.
jaysonic/src/server/index.js
Line 282 in 7076976
The text was updated successfully, but these errors were encountered: