WebApi使用URL拼接参数形式传人后台自动解析为实体对象
WebApi使用URL拼接参数形式传人后台自动解析为实体对象测试代码:
C# Code:
string url_param = "act=000000&apikey=22222&data=333333&encrypt=false&sign=444444";
string result = WebApiTools.Post("http://localhost:8899/api/testapi/post",
url_param, "application/x-www-form-urlencoded;charset=UTF-8");
txtResponse.Text = result;
WebAPI接口:
C# Code:
[HttpPost]
[Route("post")]
public override IUserResponse DoPost(ModelRequest model)
{
return new ModelResponse { Code = 0, Message = ".Post-->OK" };
}
测试结果: