-
-
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
Return HttpResponse object to chain methods #1224
Comments
Thanks for your ideas! As returning errors as JSON payload is not standardized (but there are certainly enough implementations out there that use it that way), personally I would have written a helper function, or even keep a global JSON bad request response, so that it could be reused. I think I may see what you are trying to achieve here, but I think it is more of a cosmetic nature, or doing things in a different way. In my opinion there should not be different interfaces for basically the same behavior, as this will cause confusion for framework users. I rather prefer a sanctioned way. I think this kind of changes would fit best into the Drogon 2.0 release cycle where we have the chance to introduce API breaking changes. We already have issue #682, and #806 for API breaking changes. I think this open discussion better fits at these places. |
Great, should I close this issue ? |
Sure, feel free to close it, as it should be already referenced in the other two issues 😄 |
Is your feature request related to a problem? Please describe.
I've seen a continuous pattern in my code where I create the
HttpResponse
and then set the status code to return a response like:Describe the solution you'd like
Wouldn't it be much nicer if we could write it as:
and the same for headers:
These methods return
void
so I don't think they will break the API consistency, am I right?The text was updated successfully, but these errors were encountered: