1. 程式人生 > >Web-API請求前端與後端對應分析

Web-API請求前端與後端對應分析

api請求分析

Http請求的頭部:

1.前端
ContentType="application/x-www-form-urlencoded"
Request URL:http://apidemo.bestkf.com/Account/QueryUserByUserName
Request Method: POST
PostBody: {"username":"bestkf"}
2.對應的api端
public UserInfo QueryUserByUserName([FromBody]string username)


1.前端
ContentType="application/x-www-form-urlencoded"
Request URL:http://apidemo.bestkf.com/Account/QueryUserByUserName?username=bestkf Request Method: POST 2.對應的api端 public UserInfo QueryUserByUserName(string username) 1.前端 ContentType="application/json" Request URL:http://apidemo.bestkf.com/Account/QueryUserByUserName Request Method: POST PostBody: {"username"
:"bestkf"} 2.對應的api端 public UserInfo QueryUserByUserName([FromBody]string username) 或者 public UserInfo QueryUserByUserName(string username)