I'm having a hell of a time trying to figure out why the same line returns request body as string in Post() and an empty string in Put() and ultimately how to get the request body in Put().
[HttpPost]
public JsonResult Post()
{
...
var todoJson = new StreamReader(Request.InputStream).ReadToEnd();
...
}
[HttpPut]
public JsonResult Put(int id)
{
...
var todoJson = new StreamReader(Request.InputStream).ReadToEnd();
...
}
Based on ((System.Web.HttpInputStream)(Request.InputStream))._data._data
i got in Put(), the byte values are in the request body, however I am failing to extract the content.
Any help greatly appreciated.
Edit: The method from HttpRequest.InputStream documentation works in Post(), in Put() it returns a string "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0..." of Content-Length.