Skip to content

Commit e0dc8e3

Browse files
authored
Alphabetically sort initialized properties of RestResponse
Sorting the properties alphabetically to improve code readability and makes it easier to locate specific properties during maintenance.
1 parent ad6791c commit e0dc8e3

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/RestSharp/Response/RestResponse.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ public class RestResponse<T>(RestRequest request) : RestResponse(request) {
3535
public static RestResponse<T> FromResponse(RestResponse response)
3636
=> new(response.Request) {
3737
Content = response.Content,
38-
RawBytes = response.RawBytes,
3938
ContentEncoding = response.ContentEncoding,
40-
Version = response.Version,
39+
ContentHeaders = response.ContentHeaders,
4140
ContentLength = response.ContentLength,
4241
ContentType = response.ContentType,
4342
Cookies = response.Cookies,
44-
ErrorMessage = response.ErrorMessage,
4543
ErrorException = response.ErrorException,
44+
ErrorMessage = response.ErrorMessage,
4645
Headers = response.Headers,
47-
ContentHeaders = response.ContentHeaders,
4846
IsSuccessStatusCode = response.IsSuccessStatusCode,
47+
RawBytes = response.RawBytes,
4948
ResponseStatus = response.ResponseStatus,
5049
ResponseUri = response.ResponseUri,
50+
RootElement = response.RootElement,
5151
Server = response.Server,
5252
StatusCode = response.StatusCode,
5353
StatusDescription = response.StatusDescription,
54-
RootElement = response.RootElement
54+
Version = response.Version
5555
};
5656
}
5757

@@ -82,22 +82,22 @@ async Task<RestResponse> GetDefaultResponse() {
8282

8383
return new RestResponse(request) {
8484
Content = content,
85-
RawBytes = bytes,
8685
ContentEncoding = httpResponse.Content?.Headers.ContentEncoding ?? Array.Empty<string>(),
87-
Version = httpResponse.RequestMessage?.Version,
86+
ContentHeaders = httpResponse.Content?.Headers.GetHeaderParameters(),
8887
ContentLength = httpResponse.Content?.Headers.ContentLength,
8988
ContentType = httpResponse.Content?.Headers.ContentType?.MediaType,
90-
ResponseStatus = calculateResponseStatus(httpResponse),
89+
Cookies = cookieCollection,
9190
ErrorException = httpResponse.MaybeException(),
91+
Headers = httpResponse.Headers.GetHeaderParameters(),
92+
IsSuccessStatusCode = httpResponse.IsSuccessStatusCode,
93+
RawBytes = bytes,
94+
ResponseStatus = calculateResponseStatus(httpResponse),
9295
ResponseUri = httpResponse.RequestMessage?.RequestUri,
96+
RootElement = request.RootElement,
9397
Server = httpResponse.Headers.Server.ToString(),
9498
StatusCode = httpResponse.StatusCode,
9599
StatusDescription = httpResponse.ReasonPhrase,
96-
IsSuccessStatusCode = httpResponse.IsSuccessStatusCode,
97-
Headers = httpResponse.Headers.GetHeaderParameters(),
98-
ContentHeaders = httpResponse.Content?.Headers.GetHeaderParameters(),
99-
Cookies = cookieCollection,
100-
RootElement = request.RootElement
100+
Version = httpResponse.RequestMessage?.Version
101101
};
102102
}
103103
}

0 commit comments

Comments
 (0)