-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Context PostValueIntDefault method should be return (int, error) ? #937
Comments
Hello @jefurry, The implementation you're asking for is absolutely logical and I was thinking the same when I decide to add them. The Unfortunately (?) I can't change it now, because it will bring breaking changes. What we can do instead? We can create new functions to complete your request, if you're OK with this, you can also recommend some names for those :) Thanks, |
I think there was a problem at the beginning. PostValueXXX is not need to a default value, if want to catch any error that using PostValueXXX otherwise using PostValueXXXDefault. now It's confusing!
change to:
As you said, it will bring breaking changes if you change it now. But you will eventually do it! |
and
we hope so. raw body should be cached. because sometimes we want to deal with it ourselves! |
OK @jefurry so we have to propose a breaking API change there, I am fine with it, practically you have right, I had too but we will have some issues with users post this as "bug" so we have to help them as well (although we could just keep the XXXDefault which will return a default value and a non-nil error if not found or parse errors as well). The result will be the same at the end but more expected the source code, nice. The |
This will change the |
And the |
i mean that thanks! |
iris/context/context.go
i think PostValueIntDefault method should be return int. if happend error, given it zero.
same as PostValueInt64Default, PostValueFloat64Default, URLParamIntDefault, URLParamInt64Default, URLParamFloat64Default etc. because i want to get a value only.
The text was updated successfully, but these errors were encountered: