|
18 | 18 | using System.Collections.Generic;
|
19 | 19 | using System.Net;
|
20 | 20 | using RestSharp.Extensions;
|
| 21 | +using System.Diagnostics; |
21 | 22 |
|
22 | 23 | namespace RestSharp
|
23 | 24 | {
|
| 25 | + |
24 | 26 | /// <summary>
|
25 | 27 | /// Base class for common properties shared by RestResponse and RestResponse[[T]]
|
26 | 28 | /// </summary>
|
| 29 | + [DebuggerDisplay("{DebuggerDisplay()}")] |
27 | 30 | public abstract class RestResponseBase
|
28 | 31 | {
|
29 | 32 | private string _content;
|
@@ -133,12 +136,23 @@ public ResponseStatus ResponseStatus
|
133 | 136 | /// The exception thrown during the request, if any
|
134 | 137 | /// </summary>
|
135 | 138 | public Exception ErrorException { get; set; }
|
| 139 | + |
| 140 | + |
| 141 | + /// <summary> |
| 142 | + /// Assists with debugging responses by displaying in the debugger output |
| 143 | + /// </summary> |
| 144 | + /// <returns></returns> |
| 145 | + protected string DebuggerDisplay() |
| 146 | + { |
| 147 | + return string.Format("{0}: {1} ({2})", StatusCode, ContentType, ContentLength); |
| 148 | + } |
136 | 149 | }
|
137 | 150 |
|
138 | 151 | /// <summary>
|
139 | 152 | /// Container for data sent back from API including deserialized data
|
140 | 153 | /// </summary>
|
141 | 154 | /// <typeparam name="T">Type of data to deserialize to</typeparam>
|
| 155 | + [DebuggerDisplay("{DebuggerDisplay()}")] |
142 | 156 | public class RestResponse<T> : RestResponseBase, IRestResponse<T>
|
143 | 157 | {
|
144 | 158 | /// <summary>
|
@@ -171,5 +185,6 @@ public static explicit operator RestResponse<T>(RestResponse response)
|
171 | 185 | /// <summary>
|
172 | 186 | /// Container for data sent back from API
|
173 | 187 | /// </summary>
|
| 188 | + [DebuggerDisplay("{DebuggerDisplay()}")] |
174 | 189 | public class RestResponse : RestResponseBase, IRestResponse { }
|
175 | 190 | }
|
0 commit comments