Skip to content

Commit

Permalink
Merge pull request #401 from commercetools/gen-sdk-updates
Browse files Browse the repository at this point in the history
Update generated SDKs
  • Loading branch information
kodiakhq[bot] authored Feb 4, 2025
2 parents 9397332 + b18238e commit 600cc37
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ await Assert.ThrowsAsync<NotFoundException>(async () =>
});
});
}

[Fact]
public async Task HeadNotFoundReturnsDefault()
{
Expand All @@ -76,7 +76,7 @@ await Assert.ThrowsAsync<NotFoundException>(async () =>
{
await apiRoot.Products().WithKey(product.Key + "-unknown").Get().ExecuteAsync();
});

var sendProduct = await apiRoot.Products().WithKey(product.Key).Get().SendAsync();
Assert.True(sendProduct.IsSuccess());
Assert.Equal(HttpStatusCode.OK, sendProduct.StatusCode);
Expand All @@ -96,14 +96,14 @@ await Assert.ThrowsAsync<NotFoundException>(async () =>
Assert.True(sendHead.IsSuccess());
Assert.Equal(HttpStatusCode.OK, sendHead.StatusCode);
Assert.Equal("", sendHead.Body);

var sendUnknownHead = await apiRoot.Products().WithKey(product.Key + "-unknown").Head().SendAsync();
Assert.False(sendUnknownHead.IsSuccess());
Assert.Equal(HttpStatusCode.NotFound, sendUnknownHead.StatusCode);
Assert.Equal("", sendUnknownHead.Body);
});
}

[Fact]
public async Task NotFoundReturnsDefault()
{
Expand Down Expand Up @@ -147,7 +147,7 @@ await WithProduct(apiRoot, async product =>
Assert.True(sendHead.IsSuccess());
Assert.Equal(HttpStatusCode.OK, sendHead.StatusCode);
Assert.Equal("", sendHead.Body);

var sendUnknownHead = await apiRoot.Products().WithKey(product.Key + "-unknown").Head().SendAsync();
Assert.False(sendUnknownHead.IsSuccess());
Assert.Equal(HttpStatusCode.NotFound, sendUnknownHead.StatusCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class ClientOptions
DecompressionMethods.Deflate | DecompressionMethods.GZip;

public bool ReadResponseAsStream { get; set; } = true;

public bool NotFoundReturnsDefault { get; set; } = false;
public bool HeadNotFoundReturnsDefault { get; set; } = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
if (response is { IsSuccessStatusCode: true })
return response;

if (response.StatusCode == HttpStatusCode.NotFound && (_notFoundReturnsEmpty || (_headNotFoundReturnsEmpty && request.Method == HttpMethod.Head) ))
if (response.StatusCode == HttpStatusCode.NotFound && (_notFoundReturnsEmpty || (_headNotFoundReturnsEmpty && request.Method == HttpMethod.Head)))
{
response.Content = new EmptyContent();
return response;
Expand Down
1 change: 1 addition & 0 deletions reference.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cae10cdd02689459b68469d567db1eacc1e4f60e
1 change: 1 addition & 0 deletions references.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,4 @@ e3d5bc9cb69146c5d1dd755ed5e8cf2f54566b3a
f28a1461a4122eed74c423156f1969ba204e6948
e18cd8073ea975fe92c1bad4dea957b16ee0b1c4
bfbd1780852675d9974bf71bea4afff569a4cc00
ad99469046af42aaf1e65fe1a82a2188ba6a3a3f

0 comments on commit 600cc37

Please sign in to comment.