Last active
December 21, 2015 17:49
-
-
Save justingarrick/6343093 to your computer and use it in GitHub Desktop.
Read raw JSON in a WebAPI method that uses model binding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add | |
//Request.Content.ReadAsStreamAsync().ContinueWith(t => t.Result.Seek(0, SeekOrigin.Begin)).Wait(); | |
//to your POST method, e.g. | |
[AntiForgeryToken] | |
public WeldProjectInfo Post([FromBody]RequestDetail details) | |
{ | |
try | |
{ | |
Request.Content.ReadAsStreamAsync().ContinueWith(t => t.Result.Seek(0, SeekOrigin.Begin)).Wait(); | |
WeldProjectInfo weldProjectInfo = new WeldProjectInfo(); | |
//... | |
} | |
} | |
//Step over the origin seek line, then add a watch for | |
//Request.Content.ReadAsStringAsync().Result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment