Skip to content

Commit

Permalink
#565 FlurlHttpException.StatusCode shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
tmenier committed Dec 14, 2020
1 parent 598e88e commit b5716f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Flurl.Http/FlurlHttpException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ private static string BuildMessage(FlurlCall call, Exception inner) {
return msg + ((call == null) ? "." : $": {call}");
}

/// <summary>
/// Gets the HTTP status code of the response if a response was received, otherwise null.
/// </summary>
public int? StatusCode => Call?.Response?.StatusCode;

/// <summary>
/// Gets the response body of the failed call.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Flurl.Http/FlurlResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public interface IFlurlResponse : IDisposable
HttpResponseMessage ResponseMessage { get; }

/// <summary>
/// Gets the status code of the response.
/// Gets the HTTP status code of the response.
/// </summary>
int StatusCode { get; }

Expand Down

0 comments on commit b5716f3

Please sign in to comment.