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