Fidder模拟Post请求

背景

  最近想用fidder模拟post请求,怎么都传值失败,发现写Composer => Request Body中写的内容,总是无法映射到mvc的action参数上。百度一番,发现如下解决方案:

Json格式数据传递

User-Agent: Fiddler  
Content-Type: application/json; charset=utf-8    

  这样在Requestbody里就可以编写json格式字符串了。

&拼接格式传递

User-Agent: Fiddler
Content-Type: application/x-www-form-urlencoded

  这样在Reuestbody里写 a=1&b=1

其实重点在于 设置合适的ContentType,另在Requestbody里填写的内容,后台也可以直接通过Request.InputStream获取。

原文地址:https://www.cnblogs.com/codealone/p/4494124.html