Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于koa2 参数传不进去 #32

Open
yuanlue opened this issue Mar 24, 2018 · 1 comment
Open

关于koa2 参数传不进去 #32

yuanlue opened this issue Mar 24, 2018 · 1 comment

Comments

@yuanlue
Copy link

yuanlue commented Mar 24, 2018

试着用了koa的框架集成进来 做一个参数验证的中间件 试了几次 发现静态的数据传过去没有问题
但是通过路由传来的数据貌似不起作用
随后发现源代码中 validate的这个方法检查属性用的是hasownproperty 这个方法 不能检查对象原型链中的属性
于是将hasownproperty 换成了 key in obj 才可以使用

var has = key in obj

@paranoidjk
Copy link
Contributor

什么情况下真实的参数会在原型链上而不再对象上? 能否举个实际例子?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants