NancyFx / Nancy

Lightweight, low-ceremony, framework for building HTTP based services on .Net and Mono
http://nancyfx.org
MIT License
7.15k stars 1.47k forks source link

Combining regex segments + optional segments? #2888

Open JustinSarwer opened 6 years ago

JustinSarwer commented 6 years ago

Is it possible to combine the regex segments & the optional capture segments?

Something like /test/{(?:foo|bar)?}. Just so it matches if foo or bar is present in the URL, or, if nothing is specified there at all.

khellang commented 6 years ago

I don't think this is possible today. There's no way of composing different constraints. See https://github.com/NancyFx/Nancy/issues/1418