-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Optionally throw error for unsupported arguments #358
Conversation
Changes Unknown when pulling d0146eb on 18F:master into * on flask-restful:master*. |
1 similar comment
Changes Unknown when pulling d0146eb on 18F:master into * on flask-restful:master*. |
def test_strict_parsing_on(self): | ||
req = Request.from_values("/bubble?foo=baz") | ||
parser = RequestParser() | ||
with self.assertRaises(exceptions.BadRequest): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this style is not supported in unittest
under python2.6. This should work instead:
self.assertRaises(exceptions.BadRequest, parser.parse_args, req, strict=True)
Changes Unknown when pulling 9c3be74 on 18F:master into * on flask-restful:master*. |
"""Parse all arguments from the provided request and return the results | ||
as a Namespace | ||
|
||
if ``strict``, then parsing req with args not in parser will throw exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes Unknown when pulling 6b56800 on 18F:master into * on flask-restful:master*. |
Optionally throw error for unsupported arguments
Thanks for taking care of this @catherinedevlin! |
Happy to! Thanks for the coaching! |
Here's my suggested implementation for issue #355
I'm open to suggestions from the web-savvier if there's a more appropriate response than BadRequest.