#366 Rewind the request buffer after parsing the form.

This commit is contained in:
Chris R 2015-09-08 12:04:53 -07:00
parent 43d0b0f65b
commit 4e0f0c79ec
2 changed files with 5 additions and 0 deletions

View File

@ -152,6 +152,9 @@ namespace Microsoft.AspNet.Http.Features.Internal
}
}
// Rewind so later readers don't have to.
_request.Body.Seek(0, SeekOrigin.Begin);
Form = new FormCollection(formFields, files);
return Form;
}

View File

@ -32,6 +32,8 @@ namespace Microsoft.AspNet.Http.Features.Internal
// Assert
Assert.Equal("bar", formCollection["foo"]);
Assert.Equal("2", formCollection["baz"]);
Assert.Equal(0, context.Request.Body.Position);
Assert.True(context.Request.Body.CanSeek);
// Cached
formFeature = context.Features.Get<IFormFeature>();