Skip to content

Commit

Permalink
Add RequestResult.StatusCode property
Browse files Browse the repository at this point in the history
Closes #1059
  • Loading branch information
nozzlegear committed May 14, 2024
1 parent 67dd349 commit 79295a8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ShopifySharp/Infrastructure/RequestResult.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#nullable enable
using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;

Expand All @@ -14,6 +15,8 @@ public class RequestResult<T>

public HttpResponseHeaders ResponseHeaders { get; }

public HttpStatusCode StatusCode { get; }

public T Result { get; }

public string RawResult { get; }
Expand All @@ -26,11 +29,12 @@ public class RequestResult<T>
[Obsolete("This constructor is obsolete and will be removed in a future version of ShopifySharp.")]
public RequestResult(HttpResponseMessage response, T result, string rawResult, string rawLinkHeaderValue)
{
this.Response = response;
this.ResponseHeaders = response.Headers;
this.Result = result;
this.RawResult = rawResult;
this.RawLinkHeaderValue = rawLinkHeaderValue;
Response = response;
ResponseHeaders = response.Headers;
Result = result;
RawResult = rawResult;
RawLinkHeaderValue = rawLinkHeaderValue;
StatusCode = response.StatusCode;
}

public RequestResult(
Expand All @@ -39,14 +43,16 @@ public RequestResult(HttpResponseMessage response, T result, string rawResult, s
HttpResponseHeaders httpResponseHeaders,
T result,
string rawResult,
string rawLinkHeaderValue)
string rawLinkHeaderValue,
HttpStatusCode statusCode)
{
RequestInfo = requestInfo;
Response = httpResponseMessage;

Check warning on line 50 in ShopifySharp/Infrastructure/RequestResult.cs

View workflow job for this annotation

GitHub Actions / Unit tests

'RequestResult<T>.Response' is obsolete: 'This property is obsolete and will be removed in a future version of ShopifySharp. If you need to use the response headers, please use the ResponseHeaders property instead.'
ResponseHeaders = httpResponseHeaders;
Result = result;
RawResult = rawResult;
RawLinkHeaderValue = rawLinkHeaderValue;
StatusCode = statusCode;
}

public RestBucketState GetRestBucketState()
Expand Down

0 comments on commit 79295a8

Please sign in to comment.