-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Allow extensible returning in handlers #66
Comments
One solution for this issue + support for all other types would be to introduce a |
so I was trying out yesterday's solution. it caused a circular dependency which I should've anticipated.. So I changed the method to just a content type variable, which for some reason didn't work. So I changed it to a method that returned the content type, which worked, here's the code. struct returnable
{
virtual const std::string dump() = 0;
virtual const std::string content_type() = 0;
}; Implementation for The child class would add an implementation to these, allowing it to be returned from a handler. |
@mrozigor as I'm not as familiar with C++ as I would like to be, what do you think of this approach?, does it make sense? is there a better way to go about it? |
This looks good - I think it is good to explicitly 'mark' class as returnable. |
@The-EDev IMHO it is better to use It makes the code more readable and less confusing to new comers. |
Well I'm mainly following the existing code, as far as I understand, the main difference between |
But to new contributers, this code at the first glance look like a C-like structure (aggregate), not a virtual base class since there isn't a constructor or destructor. Personally I think it is better to use |
we have JSON mode, basically sets the content-type header to application/json, just make the same thing for multipart, instead of converting to string and returning that, something like:
The text was updated successfully, but these errors were encountered: