You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is making it impossible for me to use vibe.d to re-implement an existing REST API without dirty hacks, rolling my own route generator, or changing vibe.d code.
Edit: I'm using the following workaround for now, but it's not ideal:
typeof(toDelegate(&Router.handleRequest))
getHandler(Router)(Router router)
{
return (req, res) {
req.requestPath.endsWithSlash = true;
// or to disallow URLs with trailing slashes://req.requestPath.endsWithSlash = !req.requestPath.endsWithSlash;
(&router.handleRequest)(req, res);
};
}
// ...voidmain()
{
auto router = new URLRouter;
router.registerRestInterface(newMyAPI());
listenHTTP(newHTTPServerSettings(), getHandler(router));
}
the web interfaces have a setting to ignore trailing slashes (which is true by default).
and if you disable it like so:
then the logs show something like this (no trailing slash):
but the rest interface settings dont have such an option, and i couldnt manage to get the same effect without using redirects:
and looks like this is how web interface handles this option:
vibe.d/web/vibe/web/web.d
Lines 216 to 228 in fee3872
i could also try implementing this myself if the suggestion is accepted.
The text was updated successfully, but these errors were encountered: