You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[WebApiHandler(HttpVerbs.Post,RelativePath+"people/*")]publicasyncTask<bool>PostPeople(WebServerserver,HttpListenerContextcontext){
...
var post = context.RequestFormData();// OKvarmodel= context.ParseJson<GridDataRequest>();// will be null
...}
OR
[WebApiHandler(HttpVerbs.Post,RelativePath+"people/*")]publicasyncTask<bool>PostPeople(WebServerserver,HttpListenerContextcontext){
...
var model = context.ParseJson<GridDataRequest>();// OKvarpost= context.RequestFormData();// will be null
...}
The problem come from the underlying inputStream : when StreamReader is disposed, it lets the cursor position to the end. So the next call to StreamReader(inputStream) will be null.
I've tried to use Read(pos, len) or force body.Position = 0 but this stream cannot be seek or written. Same problem using a MemoryStream and CopyTo... Do you have an idea to fix it ?
The text was updated successfully, but these errors were encountered:
This is most likely the underlying design of the http.sys implementation as the backing http stream is not rewindable for obvious reasons but thanks for checking @geoperez
[WebApiHandler(HttpVerbs.Post,RelativePath+"people/*")]publicasyncTask<bool>PostPeople(WebServerserver,HttpListenerContextcontext){
...
var body = context.RequestBody();// just one call to inputStreamvarmodel= context.ParseJson<GridDataRequest>(body);// okvarpost= body.FormData();// ok
...}
How to reproduce (in the ResApiSample.cs) :
OR
The problem come from the underlying inputStream : when StreamReader is disposed, it lets the cursor position to the end. So the next call to StreamReader(inputStream) will be null.
I've tried to use
Read(pos, len)
or forcebody.Position = 0
but this stream cannot be seek or written. Same problem using a MemoryStream and CopyTo... Do you have an idea to fix it ?The text was updated successfully, but these errors were encountered: