Skip to content
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
3 changes: 3 additions & 0 deletions sdk/data/azcosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 0.3.5 (2023-05-09)

### Features Added
* Added support for accounts with [merge support](https://aka.ms/cosmosdbsdksupportformerge) enabled

### Bugs Fixed
* Fixed unmarshalling error when using projections in value queries

Expand Down
1 change: 1 addition & 0 deletions sdk/data/azcosmos/cosmos_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ func (c *Client) createRequest(

req.Raw().Header.Set(headerXmsDate, time.Now().UTC().Format(http.TimeFormat))
req.Raw().Header.Set(headerXmsVersion, "2020-11-05")
req.Raw().Header.Set(cosmosHeaderSDKSupportedCapabilities, supportedCapabilitiesHeaderValue)

req.SetOperationValue(operationContext)

Expand Down
4 changes: 4 additions & 0 deletions sdk/data/azcosmos/cosmos_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ func TestCreateRequest(t *testing.T) {
t.Errorf("Expected %v, but got %v", "2020-11-05", req.Raw().Header.Get(headerXmsVersion))
}

if req.Raw().Header.Get(cosmosHeaderSDKSupportedCapabilities) != supportedCapabilitiesHeaderValue {
t.Errorf("Expected %v, but got %v", supportedCapabilitiesHeaderValue, req.Raw().Header.Get(cosmosHeaderSDKSupportedCapabilities))
}

opValue := pipelineRequestOptions{}
if !req.OperationValue(&opValue) {
t.Error("Expected to find operation value")
Expand Down
1 change: 1 addition & 0 deletions sdk/data/azcosmos/cosmos_headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const (
cosmosHeaderIsBatchRequest string = "x-ms-cosmos-is-batch-request"
cosmosHeaderIsBatchAtomic string = "x-ms-cosmos-batch-atomic"
cosmosHeaderIsBatchOrdered string = "x-ms-cosmos-batch-ordered"
cosmosHeaderSDKSupportedCapabilities string = "x-ms-cosmos-sdk-supportedcapabilities"
headerXmsDate string = "x-ms-date"
headerAuthorization string = "Authorization"
headerContentType string = "Content-Type"
Expand Down
21 changes: 21 additions & 0 deletions sdk/data/azcosmos/sdk_capabilities.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package azcosmos

import "strconv"

type supportedCapabilities uint64

const (
supportedCapabilitiesNone supportedCapabilities = 0
supportedCapabilitiesPartitionMerge supportedCapabilities = 1 << 0
)

var supportedCapabilitiesHeaderValue = supportedCapabilitiesAsString()

func supportedCapabilitiesAsString() string {
supported := supportedCapabilitiesNone
supported |= supportedCapabilitiesPartitionMerge
return strconv.FormatUint(uint64(supported), 10)
}