Skip to content

Commit 7646b2a

Browse files
committed
These need to not be init only, because it can be quite useful to return mocked responses and it these are all init only, we cannot adjust them after creating a new instance.
I guess you could argue we should mock the class instead, so I could try that also, but is there any reason not to allow these properties to be setters so its easier for faking responses from lower level services?
1 parent 17a3532 commit 7646b2a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/RestSharp/Response/RestResponseBase.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,67 +38,67 @@ public abstract class RestResponseBase {
3838
/// <summary>
3939
/// MIME content type of response
4040
/// </summary>
41-
public string? ContentType { get; init; }
41+
public string? ContentType { get; set; }
4242

4343
/// <summary>
4444
/// Length in bytes of the response content
4545
/// </summary>
46-
public long? ContentLength { get; init; }
46+
public long? ContentLength { get; set; }
4747

4848
/// <summary>
4949
/// Encoding of the response content
5050
/// </summary>
51-
public ICollection<string> ContentEncoding { get; init; } = new List<string>();
51+
public ICollection<string> ContentEncoding { get; set; } = new List<string>();
5252

5353
/// <summary>
5454
/// String representation of response content
5555
/// </summary>
56-
public string? Content { get; init; }
56+
public string? Content { get; set; }
5757

5858
/// <summary>
5959
/// HTTP response status code
6060
/// </summary>
61-
public HttpStatusCode StatusCode { get; init; }
61+
public HttpStatusCode StatusCode { get; set; }
6262

6363
/// <summary>
6464
/// Whether or not the response status code indicates success
6565
/// </summary>
66-
public bool IsSuccessful { get; init; }
66+
public bool IsSuccessful { get; set; }
6767

6868
/// <summary>
6969
/// Description of HTTP status returned
7070
/// </summary>
71-
public string? StatusDescription { get; init; }
71+
public string? StatusDescription { get; set; }
7272

7373
/// <summary>
7474
/// Response content
7575
/// </summary>
76-
public byte[]? RawBytes { get; init; }
76+
public byte[]? RawBytes { get; set; }
7777

7878
/// <summary>
7979
/// The URL that actually responded to the content (different from request if redirected)
8080
/// </summary>
81-
public Uri? ResponseUri { get; init; }
81+
public Uri? ResponseUri { get; set; }
8282

8383
/// <summary>
8484
/// HttpWebResponse.Server
8585
/// </summary>
86-
public string? Server { get; init; }
86+
public string? Server { get; set; }
8787

8888
/// <summary>
8989
/// Cookies returned by server with the response
9090
/// </summary>
91-
public CookieCollection? Cookies { get; init; }
91+
public CookieCollection? Cookies { get; set; }
9292

9393
/// <summary>
9494
/// Response headers returned by server with the response
9595
/// </summary>
96-
public IReadOnlyCollection<HeaderParameter>? Headers { get; init; }
96+
public IReadOnlyCollection<HeaderParameter>? Headers { get; set; }
9797

9898
/// <summary>
9999
/// Content headers returned by server with the response
100100
/// </summary>
101-
public IReadOnlyCollection<HeaderParameter>? ContentHeaders { get; init; }
101+
public IReadOnlyCollection<HeaderParameter>? ContentHeaders { get; set; }
102102

103103
/// <summary>
104104
/// Status of the request. Will return Error for transport errors.

0 commit comments

Comments
 (0)