Skip to content

Commit dd46952

Browse files
committed
Json fix
1 parent 0b5e2ad commit dd46952

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/OpenRasta.Codecs.Newtonsoft.Json/NewtonsoftJsonCodec.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public async Task WriteTo(object entity, IHttpEntity response, IEnumerable<strin
4949
public async Task<object> ReadFrom(IHttpEntity request, IType destinationType, string destinationName)
5050
{
5151
var content = await new StreamReader(request.Stream, Encoding.UTF8).ReadToEndAsync();
52-
return JsonConvert.DeserializeObject(content, _settings ?? DefaultSettings);
52+
return JsonConvert.DeserializeObject(content, destinationType.StaticType, _settings ?? DefaultSettings);
5353
}
5454
}
5555
}

src/TestingKeepAlive.Console/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ static void Main(string[] args)
2424
{
2525
var request = CreateRequest(address);
2626
request.Method = "POST";
27+
request.ContentType = "application/json";
2728

2829
using (var str = request.GetRequestStream())
2930
{
30-
var bytes = Encoding.UTF8.GetBytes("{ Data: [1, 2, 3] }");
31+
var bytes = Encoding.UTF8.GetBytes(@"{ ""Data"": [1, 2, 3] }");
3132
str.Write(bytes, 0, bytes.Length);
3233
}
3334

@@ -111,7 +112,7 @@ static HttpWebRequest CreateRequest(Uri uri)
111112

112113
// Uncomment either of the following lines and the issue goes away
113114
//r.KeepAlive = false;
114-
//r.ProtocolVersion = HttpVersion.Version10;
115+
r.ProtocolVersion = HttpVersion.Version10;
115116

116117
return r;
117118
}

0 commit comments

Comments
 (0)