GH 900 (backport from D2)

https://github.com/PerlDancer/Dancer/issues/900

I tried to do what you meant, not sure it's really what you want. It passes tests though.