-
-
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
Result of the block in the 'given' method are ignored #2191
Labels
Comments
Try writing a spec for this that passed in 1.0.2? |
The controller:
The spec (with rspec-grape):
The result of rspec:
|
PR the spec - and maybe try a fix? |
Unfortunately not, I've looked in the params_scope.rb, it quite complicated. I only found the block calls, but its result doesn't stored or analyzed. But in the Grape 1.0.2 this piece of code looks the same, with different behaviour in results. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
In the Grape 1.0.2 the code below works fine:
When the request were from Apple Pay, the card_holder parameter became Hash and were parsed as Hash,
otherwise it been treated as String. It was fine for a time, but then the Grape were upgraded to 1.5.3,
this behavior became broken. In the version 1.5.3, result of the blocks in the 'given' method are ignored
and 'declared' method resturns all the parameters defined in 'params' without conditions. In the case above, the 'cardholder',
passed from request as string in accordance with payment_type='ccard', parsed by Grape as Hash instead of string,
and causes exception
in the line
grape/lib/grape/dsl/inside_route.rb
Line 61 in e83e81f
It is unexpected behaviour and I didn't find any notes about changes in the 'given' methods, it's looks like a bug.
The text was updated successfully, but these errors were encountered: