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

对于Post请求,在logic中验证int类型,如果使用application/json格式传递数据,验证有问题 #546

Closed
Qyf-Aaron opened this issue Jan 10, 2017 · 1 comment

Comments

@Qyf-Aaron
Copy link

DESC

对于Post请求,在logic中验证int类型,如果使用application/json格式传递数据,验证有问题。
具体表现为当int=0是,ThinkJS会认为该值不存在而返回参数不存在的错误。当使用application/x-www-form-urlencoded格式,则能够正确处理int=0的情况。
(例如:
this.allowMethods = 'post';
this.rules = {
id: 'required',
type: 'required|int|in:0,1'
};

如果type=0,则在application/json格式下验证错误

ENV

Platform: mac

Node.js Version: v6.7.0

ThinkJS Version: 2.2.13

@welefen
Copy link
Member

welefen commented Jun 9, 2017

已经在 2.2.19 版本中修复

@welefen welefen closed this as completed Jun 9, 2017
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