Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions RestSharp/RestResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@
using System.Collections.Generic;
using System.Net;
using RestSharp.Extensions;
using System.Diagnostics;

namespace RestSharp
{

/// <summary>
/// Base class for common properties shared by RestResponse and RestResponse[[T]]
/// </summary>
[DebuggerDisplay("{DebuggerDisplay()}")]
public abstract class RestResponseBase
{
private string _content;
Expand Down Expand Up @@ -133,12 +136,23 @@ public ResponseStatus ResponseStatus
/// The exception thrown during the request, if any
/// </summary>
public Exception ErrorException { get; set; }


/// <summary>
/// Assists with debugging responses by displaying in the debugger output
/// </summary>
/// <returns></returns>
protected string DebuggerDisplay()
{
return string.Format("{0}: {1} ({2})", StatusCode, ContentType, ContentLength);
}
}

/// <summary>
/// Container for data sent back from API including deserialized data
/// </summary>
/// <typeparam name="T">Type of data to deserialize to</typeparam>
[DebuggerDisplay("{DebuggerDisplay()}")]
public class RestResponse<T> : RestResponseBase, IRestResponse<T>
{
/// <summary>
Expand Down Expand Up @@ -171,5 +185,6 @@ public static explicit operator RestResponse<T>(RestResponse response)
/// <summary>
/// Container for data sent back from API
/// </summary>
[DebuggerDisplay("{DebuggerDisplay()}")]
public class RestResponse : RestResponseBase, IRestResponse { }
}