Skip to content

Commit 4826f2b

Browse files
author
Michael Hallett
committed
Closes #617 Response Extensions toAsyncResponse; Code cleanup;
1 parent d72d3a7 commit 4826f2b

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

RestSharp/Deserializers/JsonDeserializer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private IDictionary BuildDictionary(Type type, object parent)
120120
foreach (var child in (IDictionary<string, object>)parent)
121121
{
122122
var key = child.Key;
123-
object item = null;
123+
object item;
124124

125125
if (valueType.IsGenericType && valueType.GetGenericTypeDefinition() == typeof(List<>))
126126
{
@@ -197,7 +197,7 @@ private object ConvertValue(Type type, object value)
197197
type = type.GetGenericArguments()[0];
198198
}
199199

200-
if (type == typeof(System.Object) && value != null)
200+
if (type == typeof(Object) && value != null)
201201
{
202202
type = value.GetType();
203203
}
@@ -224,9 +224,9 @@ private object ConvertValue(Type type, object value)
224224

225225
if (type == typeof(DateTime)
226226
#if !PocketPC
227-
|| type == typeof(DateTimeOffset)
227+
|| type == typeof(DateTimeOffset)
228228
#endif
229-
)
229+
)
230230
{
231231
DateTime dt;
232232

RestSharp/Extensions/ResponseExtensions.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ namespace RestSharp.Extensions
33
{
44
public static class ResponseExtensions
55
{
6-
public static IRestResponse<T> toAsyncResponse<T>(this IRestResponse response)
6+
public static IRestResponse<T> ToAsyncResponse<T>(this IRestResponse response)
77
{
88
return new RestResponse<T>
9-
{
10-
ContentEncoding = response.ContentEncoding,
11-
ContentLength = response.ContentLength,
12-
ContentType = response.ContentType,
13-
Cookies = response.Cookies,
14-
ErrorException = response.ErrorException,
15-
ErrorMessage = response.ErrorMessage,
16-
Headers = response.Headers,
17-
RawBytes = response.RawBytes,
18-
ResponseStatus = response.ResponseStatus,
19-
ResponseUri = response.ResponseUri,
20-
Server = response.Server,
21-
StatusCode = response.StatusCode,
22-
StatusDescription = response.StatusDescription
23-
};
9+
{
10+
ContentEncoding = response.ContentEncoding,
11+
ContentLength = response.ContentLength,
12+
ContentType = response.ContentType,
13+
Cookies = response.Cookies,
14+
ErrorException = response.ErrorException,
15+
ErrorMessage = response.ErrorMessage,
16+
Headers = response.Headers,
17+
RawBytes = response.RawBytes,
18+
ResponseStatus = response.ResponseStatus,
19+
ResponseUri = response.ResponseUri,
20+
Server = response.Server,
21+
StatusCode = response.StatusCode,
22+
StatusDescription = response.StatusDescription
23+
};
2424
}
2525
}
2626
}

RestSharp/RestClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ private IRestResponse<T> Deserialize<T>(IRestRequest request, IRestResponse raw)
563563

564564
try
565565
{
566-
response = raw.toAsyncResponse<T>();
566+
response = raw.ToAsyncResponse<T>();
567567
response.Request = request;
568568

569569
// Only attempt to deserialize if the request has not errored due

0 commit comments

Comments
 (0)