I am trying to pass a route parameter (not Query Paramter!) via Nancy.Testing.Browser object. I understand (now) how to send and consume query strings to/from my NancyModule:
var customerResponse = browser.Get("/customer/id", with =>
{
with.HttpRequest();
with.Query("{id}", alansIdGuid.ToString());
});
...
Get["/customer/{id}"] = parameters =>
{
string idFromQuery = Request.Query.id;
Customer customerFromId = _customerRepo.GetCustomerById(idFromQuery);
return Response.AsJson<Customer>(customerFromId);
};
However - What I want to do is hit my route and retrieve my route parameter like so:
Get["/customer/{id}"] = parameters =>
{
string id = parameters.id;
Customer customerFromId = _customerRepo.GetCustomerById(id);
return Response.AsJson<Customer>(customerFromId);
};
How do I do I pass my Id parameter as a route parameter using Nancy.Testing.Browser?
-Without using Headers, Cookies or Query strings?
This has been a 3 hour search for a seemingly simple task! The following questions dance around the issue but don't resolve it:
Send parameter to Nancy module from test
NancyFX: Routes with query string parameters always returns a 404 NotFound
Why are no query parameters being passed to my NancyFX module?