Search code examples
nancy

Working with query strings in Nancy


I'm new to Nancy,

I see I can work with the query string using Request.Query.Foo and check for the existence of the value via Request.Query.Foo.HasValue. If I try to read Foo and it does not exist, does Nancy return null or does it throw?


Solution

  • Foo will be of type DynamicDictionaryValue, so you will actually need to access the Value property to use it, just as you would a Nullable type. It won't simply throw an error for referencing Request.Query.Foo unless you try to do something with the .Value and it is null.