-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: Responses with any body type for regex route #14
Conversation
I'll have a detailed look at this tomorrow (hopefully). Glancing over your summary this seems like a very good extension. I don't mind that this introduces breaking changes as there is no initial release yet anyway. This is currently under heavy development. However, I do believe that it should be doable to get |
Your PR includes the changes for MSVC builds. |
e3578a3
to
cb54a16
Compare
Hum.... I can't build anymore, even with
|
The tests don't add those flags, could that be the problem? I'm not very familier with object libraries |
This implements #13. Its not the most pretty implementation and I welcome any feedback on it or alternatives. All tests pass on both windows (msvc v142) and linux (fedora 33/gcc 1.11.1). On MSVC it needs /bigobj to compile router.
Note this is, unfortunately, a breaking change. Most non-trivial code that currently uses this library will not compile against this patch. It is a compile error though, and is easy enough to fix, mostly just adding <> to the
response
and making some handlers returnstd::variant<...>
. Again, feedback on this is welcome.I've done some basic testing of this server-side but I don't have a project currently that uses this client-side. I also haven't tested it with tls.
Notable changes:
std::variant<...file_body,...string_body...>
which is either an error response (as a string body) or the filerouter::add
is now templated and will accept any function that takes inconst request_type&
and returns either a variant containing responses or a single response type (which is wrapped before being passed on). This allows mostly seamless compatability with the exception being handlers that need to return multiple types of response (which now need to specifiy the variant explicitly, which is kind of horrible, maybe should be a using with only the body types passed?)closes: #13