Nancy passes my query string and forms the values ββto my handlers using a variable dynamic. The following example shows the form values ββpassed to the POST handler through a Nancy request, for example. Request.Form.xxx.
Handler
Post["/"] = _ =>
{
var userId = (string) Request.Form.userid;
if (userId.IsEmpty()) return HttpStatusCode.UnprocessableEntity;
return HttpStatusCode.OK;
};
You can see what I am inserting useridinto the string, and then using the string extension method to check if the value is empty or empty string (equivalent string.IsNullOrEmpty()).
I would prefer to use the extension method for the dynamic type so that I can perform my health checks before doing anything else. I need a code:
if(Request.Form.userid.IsEmpty()) return HttpStatusCode.UnprocessableEntity;
dynamic. , . DLR.
, , / Nancy?