-
-
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
[BUG]hero.Resulthandler
can only handle custom struct
#2448
Comments
dydhyhwu
changed the title
[BUG]Apr 22, 2024
hero.Resulthandler
can only handle custom structhero.Resulthandler
can only handle custom struct
related code: Lines 264 to 331 in b904793
Lines 366 to 373 in b904793
|
@kataras need some help |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hero.ResultHandler
can only handle cases where the return value is a custom struct ordispatcher
. After reviewing the code, I found that beforeResultHandler
processing, it needs to go throughdispatchFuncResult
processing, and thendispatchCommon
decides whether to call handlers. I would like to know why it was designed this way.In scenarios where
Container
is used to uniformly handle return values, I hope that the return values of allHandlers
are uniformly wrapped and processed, so that a unified return value structure can be obtained. However, the framework has specialized handling for some basic types, which forces me to callctx.JSON(map[string]interface{} {...})
in some handlers.The code and expected result I hope to achieve is as follows:
when the return value is
empty
, the expected result is:when the return value is
string
, the expected result is:when the return value is
custom struct
, the expected result is :and so on...
The text was updated successfully, but these errors were encountered: