From 90ae351a78191ce4610af7fbb0f43df2733abb60 Mon Sep 17 00:00:00 2001 From: Dan Barua Date: Tue, 19 Jul 2016 16:17:32 +0100 Subject: [PATCH] Replace dependency on `RequestStream` in `Request.Body` with `Stream` Allows swapping out switchover stream behaviour --- src/Nancy/Request.cs | 8 ++++---- .../Modules/SerializerTestModule.cs | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Nancy/Request.cs b/src/Nancy/Request.cs index 32f3e2c9b5..5dd9ebed37 100644 --- a/src/Nancy/Request.cs +++ b/src/Nancy/Request.cs @@ -47,7 +47,7 @@ public Request(string method, string path, string scheme) /// The HTTP protocol version. public Request(string method, Url url, - RequestStream body = null, + Stream body = null, IDictionary> headers = null, string ip = null, X509Certificate certificate = null, @@ -148,10 +148,10 @@ public string Path public dynamic Query { get; set; } /// - /// Gets a that can be used to read the incoming HTTP body + /// Gets a that can be used to read the incoming HTTP body /// - /// A object representing the incoming HTTP body. - public RequestStream Body { get; private set; } + /// A object representing the incoming HTTP body. + public Stream Body { get; private set; } /// /// Gets the request cookies. diff --git a/test/Nancy.Tests.Functional/Modules/SerializerTestModule.cs b/test/Nancy.Tests.Functional/Modules/SerializerTestModule.cs index 7556a69b5e..4541c1102a 100644 --- a/test/Nancy.Tests.Functional/Modules/SerializerTestModule.cs +++ b/test/Nancy.Tests.Functional/Modules/SerializerTestModule.cs @@ -3,6 +3,7 @@ using System; using System.Globalization; using Nancy.Extensions; + using Nancy.IO; using Nancy.ModelBinding; public class SerializerTestModule : NancyModule @@ -25,7 +26,7 @@ public SerializerTestModule() Post("/serializer/date", args => { - var s = this.Request.Body.AsString(); + var s = ((RequestStream)this.Request.Body).AsString(); var model = this.Bind(); return model; });