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

Optionally throw error for unsupported arguments #358

Merged
merged 7 commits into from
Dec 13, 2014
Merged

Optionally throw error for unsupported arguments #358

merged 7 commits into from
Dec 13, 2014

Conversation

catherinedevlin
Copy link
Contributor

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.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d0146eb on 18F:master into * on flask-restful:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

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):
Copy link
Member

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)

@coveralls
Copy link

Coverage Status

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 6b56800 on 18F:master into * on flask-restful:master*.

@joshfriend joshfriend modified the milestone: 0.3.1 Dec 13, 2014
joshfriend added a commit that referenced this pull request Dec 13, 2014
Optionally throw error for unsupported arguments
@joshfriend joshfriend merged commit 7fb809d into flask-restful:master Dec 13, 2014
@joshfriend
Copy link
Member

Thanks for taking care of this @catherinedevlin!

@catherinedevlin
Copy link
Contributor Author

Happy to! Thanks for the coaching!

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

Successfully merging this pull request may close these issues.

3 participants