Skip to content

Update generated SDKs #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading