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

Different behavior when type=list in add_argument [Breaking Change] #555

Closed
sibelius opened this issue Jan 7, 2016 · 3 comments
Closed

Comments

@sibelius
Copy link

sibelius commented Jan 7, 2016

I've noticed that when you don't set a location and have a argument with type list, the behavior os parsing them is different than when I set up the location='json'

Example:

parse = reqparse.RequestParser()
parse.add_argument('arg1', type=list)
parse.add_argument('arg2', type=list, location='json')
args = parse.parse_args()

When a have a POST using the Content-Type = application/json like this:

{"arg1": [{"id": "123", "name": "testing"}], "arg2": [{"id": "123", "name": "testing"}]}

I have this result:

args['arg1'] equals ["id", "name"]
args['arg2'] equals [{"id": "123", "name": "testing"}]
@sibelius
Copy link
Author

sibelius commented Jan 7, 2016

This wasn't happening on Flask-RESTful 0.2.12

@sibelius sibelius changed the title Different behavior when type=list in add_argument Different behavior when type=list in add_argument [Breaking Change] Jan 11, 2016
@sibelius
Copy link
Author

this should be consider a breaking change if the behavior doesn't work like before

@joshfriend
Copy link
Member

This is probably related to #380. I was unable to find a good solution for this and the PR I did submit to Werkzeug was declined. Due to #335 I don't feel that it is worth the effort to chase this down further.

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