1. 程式人生 > >postman && webapi 介面測試

postman && webapi 介面測試

一、POST 方式請求,body 格式為x-www-form-urlencoded

接收引數的方法: 其中url 引數可以通過引數列表接收和 HttpContext.Current.Request.QueryString["id"] 接收,x-www-form-urlencoded 資料通過 HttpContext.Current.Request.Form["userId"] 接收

 

二、通過raw -JSON 的方式向後臺傳送資料 

 

通過[FormBody] 標註,userInfo 可以正常接收到解析好的物件資訊。

 三、通過form-data 上傳檔案

可以通過 HttpContext.Current.Request.Files 正常接收到。

 

四、 像伺服器端傳送form-data 型別的 檔案和字串;

 服務端分別接收檔案和字串的方法: