From 90a2d401467f5e59b449a0d5c8f96d945be18010 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Wed, 15 Feb 2012 22:55:43 -0800 Subject: [PATCH] fixed service model binding issue. --- .../NzbDrone.Services.Service/JsonModelBinder.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/NzbDrone.Services/NzbDrone.Services.Service/JsonModelBinder.cs b/NzbDrone.Services/NzbDrone.Services.Service/JsonModelBinder.cs index 94c7a404d..7ff19609c 100644 --- a/NzbDrone.Services/NzbDrone.Services.Service/JsonModelBinder.cs +++ b/NzbDrone.Services/NzbDrone.Services.Service/JsonModelBinder.cs @@ -25,9 +25,13 @@ namespace NzbDrone.Services.Service return base.BindModel(controllerContext, bindingContext); } - using (var reader = new StreamReader(request.InputStream)) + using (var stream = request.InputStream) { - input = reader.ReadToEnd(); + stream.Seek(0, SeekOrigin.Begin); + using (var reader = new StreamReader(stream)) + { + input = reader.ReadToEnd(); + } } var deserializedObject = JsonConvert.DeserializeObject(input, bindingContext.ModelMetadata.ModelType); @@ -36,7 +40,7 @@ namespace NzbDrone.Services.Service } catch (Exception e) { - logger.FatalException("Error deserializing request. " + input, e); + logger.FatalException("Error deserilizing request. " + input, e); throw; } }