Add StatusCode to HttpResponseException#18842
Conversation
|
|
||
| HttpResponseException httpEx = new(message, response); | ||
| { | ||
| StatusCode = response.StatusCode; |
There was a problem hiding this comment.
Eh, StatusCode is read-only property - we cannot assign it :-(. Only new constructor can initialize this.
There was a problem hiding this comment.
We can do this in current constructor:
public HttpResponseException(string message, HttpResponseMessage response) : base(message, inner: null, response.StatusCode)
{
Response = response;
}There was a problem hiding this comment.
Done, very elegant solution
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
|
🎉 Handy links: |
PR Summary
I noticed that HttpResponseException contained an empty StatusCode property, so I've added response.statusCode as content.
It might be a little redundant but it's easier to access
PR Context
before:

after:
