From b5716f3f1e2d5c14b58a98a87fa41d1013ff3a35 Mon Sep 17 00:00:00 2001 From: Todd Date: Mon, 14 Dec 2020 11:37:14 -0600 Subject: [PATCH] #565 FlurlHttpException.StatusCode shortcut --- src/Flurl.Http/FlurlHttpException.cs | 5 +++++ src/Flurl.Http/FlurlResponse.cs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Flurl.Http/FlurlHttpException.cs b/src/Flurl.Http/FlurlHttpException.cs index 2412bd9a..47c0956f 100644 --- a/src/Flurl.Http/FlurlHttpException.cs +++ b/src/Flurl.Http/FlurlHttpException.cs @@ -48,6 +48,11 @@ private static string BuildMessage(FlurlCall call, Exception inner) { return msg + ((call == null) ? "." : $": {call}"); } + /// + /// Gets the HTTP status code of the response if a response was received, otherwise null. + /// + public int? StatusCode => Call?.Response?.StatusCode; + /// /// Gets the response body of the failed call. /// diff --git a/src/Flurl.Http/FlurlResponse.cs b/src/Flurl.Http/FlurlResponse.cs index b7d005a8..c346f155 100644 --- a/src/Flurl.Http/FlurlResponse.cs +++ b/src/Flurl.Http/FlurlResponse.cs @@ -32,7 +32,7 @@ public interface IFlurlResponse : IDisposable HttpResponseMessage ResponseMessage { get; } /// - /// Gets the status code of the response. + /// Gets the HTTP status code of the response. /// int StatusCode { get; }