-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix weird behaviour for optional groups with default params #936
fix weird behaviour for optional groups with default params #936
Conversation
Looks good, just needs CHANGELOG. |
@dblock up |
@@ -6,6 +6,7 @@ | |||
0.11.0 (2/23/2015) | |||
================== | |||
|
|||
* [#936](https://github.com/intridea/grape/pull/936): Fixed default params processing for optional groups - [@dm1try](https://github.com/dm1try). |
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.
I released 0.11.0 today, so this needs to bump into Next Release, sorry for the hassle.
…faults for inner params only if parent param is present
if optional array without default value includes optional param with default value, here shoud return
|
Yes, it is right but you forgot to provide So it 'optional array if empty array params' do
header 'Content-Type', 'application/json'
post '/optional_array', { optional_array: [] }.to_json
expect(last_response.status).to eq(201)
expect(last_response.body).to eq({ optional_array: [] }.to_json)
end should work |
Thank you.it works.
And, I can send an array params which not declared in the params block, right?
It passed after I add
it's weird. |
For me it seems normal. You send the json payload with |
Thank you for your explication. :-) |
Yes. |
…_groups fix weird behaviour for optional groups with default params
apply defaults for inner params only if parent param is present
fixes #615 (see for more info)
/cc @dblock take a look