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

Added support to parse objects and arrays in the request for both params and body #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

srinivasiyer
Copy link

The change is pretty light weight that allows nested object bodies and array notations in URLS to be validated using a '.' separator

http://localhost:3000?foo[bar]=foobar can be validated as

this.checkQuery('foo.bar').eq('foobar')

the above example would require the koa-qs library to parse the get params

Also a body of

{
  "foo": [{"bar": "foobar"}]
}

can be validated using

this.checkBody('foo.0.bar').eq('foobar', 'Needs to be foobar');

I have worked with nested bodies in many projects and this would really useful if you can merge the request.

@coveralls
Copy link

Coverage Status

Coverage decreased (-75.67%) to 21.36% when pulling a5af795 on srinivasiyer:master into 0252d70 on RocksonZeta:master.

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

Successfully merging this pull request may close these issues.

2 participants