Skip to content
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

No content on Response: Add the ability to have operation return no content from Cosmos DB #1439

Merged
merged 16 commits into from
May 8, 2020
Merged
Prev Previous commit
Next Next commit
Updated naming
  • Loading branch information
Jake Willey committed May 7, 2020
commit 03d1a175208ae667061363d2a29e2bc3039a23a9
4 changes: 2 additions & 2 deletions Microsoft.Azure.Cosmos/src/Batch/ItemBatchOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ internal static Result WriteOperation(ref RowWriter writer, TypeArgument typeArg
}

if (ItemRequestOptions.ShouldSetNoContentHeader(
options.NoContentResponseOnWrite,
options.NoContentResponseOnRead,
options.EnableContentResponseOnWrite,
options.EnableContentResponseOnRead,
operation.OperationType))
{
r = writer.WriteBool("minimalReturnPreference", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TransactionalBatchItemRequestOptions : RequestOptions
/// <remarks>
/// This is optimal for workloads where the returned resource is not used.
/// </remarks>
public bool? NoContentResponseOnWrite { get; set; }
public bool? EnableContentResponseOnWrite { get; set; }

/// <summary>
/// Gets or sets the boolean to only return the headers and status code in
Expand All @@ -38,7 +38,7 @@ public class TransactionalBatchItemRequestOptions : RequestOptions
/// <remarks>
/// This is optimal for workloads where the returned resource is not used.
/// </remarks>
internal bool? NoContentResponseOnRead { get; set; }
internal bool? EnableContentResponseOnRead { get; set; }

/// <summary>
/// Options to encrypt properties of the item.
Expand All @@ -62,8 +62,8 @@ internal static TransactionalBatchItemRequestOptions FromItemRequestOptions(Item
batchItemRequestOptions.IfMatchEtag = itemRequestOptions.IfMatchEtag;
batchItemRequestOptions.IfNoneMatchEtag = itemRequestOptions.IfNoneMatchEtag;
batchItemRequestOptions.Properties = itemRequestOptions.Properties;
batchItemRequestOptions.NoContentResponseOnWrite = itemRequestOptions.NoContentResponseOnWrite;
batchItemRequestOptions.NoContentResponseOnRead = itemRequestOptions.NoContentResponseOnRead;
batchItemRequestOptions.EnableContentResponseOnWrite = itemRequestOptions.EnableContentResponseOnWrite;
batchItemRequestOptions.EnableContentResponseOnRead = itemRequestOptions.EnableContentResponseOnRead;
batchItemRequestOptions.IsEffectivePartitionKeyRouting = itemRequestOptions.IsEffectivePartitionKeyRouting;
return batchItemRequestOptions;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public ConsistencyLevel? ConsistencyLevel
/// <remarks>
/// This is optimal for workloads where the returned resource is not used.
/// </remarks>
public bool? NoContentResponseOnWrite { get; set; }
public bool? EnableContentResponseOnWrite { get; set; }

/// <summary>
/// Gets or sets the boolean to only return the headers and status code in
Expand All @@ -137,7 +137,7 @@ public ConsistencyLevel? ConsistencyLevel
/// <remarks>
/// This is optimal for workloads where the returned resource is not used.
/// </remarks>
internal bool? NoContentResponseOnRead { get; set; }
internal bool? EnableContentResponseOnRead { get; set; }

/// <summary>
/// Options to encrypt properties of the item.
Expand Down Expand Up @@ -175,8 +175,8 @@ internal override void PopulateRequestOptions(RequestMessage request)
RequestOptions.SetSessionToken(request, this.SessionToken);

if (ItemRequestOptions.ShouldSetNoContentHeader(
this.NoContentResponseOnWrite,
this.NoContentResponseOnRead,
this.EnableContentResponseOnWrite,
this.EnableContentResponseOnRead,
request.OperationType))
{
request.Headers.Add(HttpConstants.HttpHeaders.Prefer, HttpConstants.HttpHeaderValues.PreferReturnMinimal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public async Task ItemCreateNoResponseTest()
{
ItemRequestOptions requestOptions = new ItemRequestOptions()
{
NoContentResponseOnWrite = true
EnableContentResponseOnWrite = true
};

await this.Validate(
Expand All @@ -64,7 +64,7 @@ public async Task ItemReadNoResponseTest()
{
ItemRequestOptions requestOptions = new ItemRequestOptions()
{
NoContentResponseOnRead = true
EnableContentResponseOnRead = true
};

await this.Validate(
Expand Down Expand Up @@ -114,7 +114,7 @@ public async Task ItemStreamCreateNoResponseTest()
{
ItemRequestOptions requestOptions = new ItemRequestOptions()
{
NoContentResponseOnWrite = true
EnableContentResponseOnWrite = true
};

await this.ValidateItemStream(
Expand All @@ -128,7 +128,7 @@ public async Task ItemStreamReadNoResponseTest()
{
ItemRequestOptions requestOptions = new ItemRequestOptions()
{
NoContentResponseOnRead = true
EnableContentResponseOnRead = true
};

await this.ValidateItemStream(
Expand Down Expand Up @@ -197,7 +197,7 @@ public async Task ItemBatchNoResponseTest()
{
TransactionalBatchItemRequestOptions requestOptions = new TransactionalBatchItemRequestOptions()
{
NoContentResponseOnWrite = true
EnableContentResponseOnWrite = true
};

string pkId = "TestBatchId";
Expand Down Expand Up @@ -249,7 +249,7 @@ public async Task ItemBulkNoResponseTest()
{
ItemRequestOptions requestOptions = new ItemRequestOptions()
{
NoContentResponseOnWrite = true
EnableContentResponseOnWrite = true
};

CosmosClient bulkClient = TestCommon.CreateCosmosClient((builder) => builder.WithBulkExecution(true));
Expand Down