|
20 | 20 | using System.Collections.Generic;
|
21 | 21 | using System.Net;
|
22 | 22 | using RestSharp.Extensions;
|
| 23 | +using System.Diagnostics; |
23 | 24 |
|
24 | 25 | namespace RestSharp
|
25 | 26 | {
|
| 27 | + |
26 | 28 | /// <summary>
|
27 | 29 | /// Base class for common properties shared by RestResponse and RestResponse[[T]]
|
28 | 30 | /// </summary>
|
| 31 | + [DebuggerDisplay("{DebuggerDisplay()}")] |
29 | 32 | public abstract class RestResponseBase
|
30 | 33 | {
|
31 | 34 | private string content;
|
@@ -122,12 +125,23 @@ public string Content
|
122 | 125 | /// The exception thrown during the request, if any
|
123 | 126 | /// </summary>
|
124 | 127 | public Exception ErrorException { get; set; }
|
| 128 | + |
| 129 | + |
| 130 | + /// <summary> |
| 131 | + /// Assists with debugging responses by displaying in the debugger output |
| 132 | + /// </summary> |
| 133 | + /// <returns></returns> |
| 134 | + protected string DebuggerDisplay() |
| 135 | + { |
| 136 | + return string.Format("{0}: {1} ({2})", StatusCode, ContentType, ContentLength); |
| 137 | + } |
125 | 138 | }
|
126 | 139 |
|
127 | 140 | /// <summary>
|
128 | 141 | /// Container for data sent back from API including deserialized data
|
129 | 142 | /// </summary>
|
130 | 143 | /// <typeparam name="T">Type of data to deserialize to</typeparam>
|
| 144 | + [DebuggerDisplay("{DebuggerDisplay()}")] |
131 | 145 | public class RestResponse<T> : RestResponseBase, IRestResponse<T>
|
132 | 146 | {
|
133 | 147 | /// <summary>
|
@@ -160,5 +174,6 @@ public static explicit operator RestResponse<T>(RestResponse response)
|
160 | 174 | /// <summary>
|
161 | 175 | /// Container for data sent back from API
|
162 | 176 | /// </summary>
|
| 177 | + [DebuggerDisplay("{DebuggerDisplay()}")] |
163 | 178 | public class RestResponse : RestResponseBase, IRestResponse { }
|
164 | 179 | }
|
0 commit comments