【发布时间】:2019-09-07 23:04:44
【问题描述】:
我需要使用 NancyFX 2.0 实现一个 POST 请求处理程序。与 GET 请求相反,我不明白如何处理 Nancy 2.0 上的 POST,因为 url 和参数变量中没有任何数据。
我的代码目前如下:
我的 NancyModule Post 方法:
Post("/add/{firstname:string}", parameters => AddAction(parameters));
AddAction 方法:
dynamic AddAction(dynamic parameters)
{
//I would need to print the JSON or bind it into a Client object here
}
这是我的客户端类:
public Client(int id, string firstName, string lastName, string address)
{
ID = id;
FirstName = firstName;
LastName = lastName;
Address = address;
}
【问题讨论】:
标签: c# rest post request nancy