Web-API請求前端與後端對應分析
阿新 • • 發佈:2018-12-26
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)