Skip to content

Commit bed88f5

Browse files
committed
Follow up fix
1 parent 7519f89 commit bed88f5

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/RestSharp/Response/RestResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async Task<RestResponse> GetDefaultResponse() {
6363
ContentLength = httpResponse.Content?.Headers.ContentLength,
6464
ContentType = httpResponse.Content?.Headers.ContentType?.MediaType,
6565
Cookies = cookieCollection,
66-
ErrorException = httpResponse.MaybeException(options.ErrorWhenUnsuccessfulStatusCode),
66+
ErrorException = httpResponse.MaybeException(options.SetErrorExceptionOnUnsuccessfulStatusCode),
6767
Headers = httpResponse.Headers.GetHeaderParameters(),
6868
IsSuccessStatusCode = httpResponse.IsSuccessStatusCode,
6969
RawBytes = bytes,

src/RestSharp/RestClient.Async.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public async Task<RestResponse> ExecuteAsync(RestRequest request, CancellationTo
4848
request.CompletionOption = HttpCompletionOption.ResponseHeadersRead;
4949
var response = await ExecuteRequestAsync(request, cancellationToken).ConfigureAwait(false);
5050

51-
var exception = response.Exception ?? response.ResponseMessage?.MaybeException(Options.ErrorWhenUnsuccessfulStatusCode);
51+
var exception = response.Exception ?? response.ResponseMessage?.MaybeException(Options.SetErrorExceptionOnUnsuccessfulStatusCode);
5252

5353
if (exception != null) {
5454
return Options.ThrowOnAnyError ? throw exception : null;

test/RestSharp.Tests.Integrated/RequestFailureTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public async Task Handles_GET_Request_Errors_With_Response_Type() {
2828

2929
[Fact]
3030
public async Task Does_not_throw_on_unsuccessful_status_code_with_option() {
31-
using var client = new RestClient(new RestClientOptions(server.Url!) { ErrorWhenUnsuccessfulStatusCode = false });
31+
using var client = new RestClient(new RestClientOptions(server.Url!) { SetErrorExceptionOnUnsuccessfulStatusCode = false });
3232
var request = new RestRequest("status?code=404");
3333
var response = await client.ExecuteAsync<SuccessResponse>(request);
3434

0 commit comments

Comments
 (0)