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为类。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM