Postman测试.Net Core WebApi Post()

 

    [HttpPost]
        public string Post([FromBody]LoginModel model)
        {
            if (model.Account == "longdb" && model.Pw == "123")
            {
                return "测试成功";
            }
            return "1222kk";

        }

vue.js 使用axios请求该类型接口:

    this.$http.post(this.$baseUrl + "/weatherforecast", { Account: "longdb", Pw: "123" }).then(res => {
        console.log(res.data);
        res = res.data;
      });

 

Postman 填写对应参数。代码中LoginModel为类。

 

posted @ 2019-12-30 10:20  longdb  阅读(1855)  评论(6编辑  收藏  举报