Skip to content

Commit

Permalink
fix a bug in function ReplaceOfferForResource caused by a change from…
Browse files Browse the repository at this point in the history
… v0.1.5
  • Loading branch information
Thanh Nguyen committed Feb 16, 2022
1 parent 9d34850 commit 6ca74d7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# gocosmos release notes

## 2022-02-16 - v0.1.6

- REST client & Driver for `database/sql`: fix a bug in function `ReplaceOfferForResource` caused by a change from v0.1.5.

## 2022-02-16 - v0.1.5

- Fix a bug where no-parameterized query returns error.
Expand Down
2 changes: 1 addition & 1 deletion gocosmos.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ package gocosmos

const (
// Version of package gocosmos.
Version = "0.1.5"
Version = "0.1.6"
)
8 changes: 7 additions & 1 deletion restclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,13 @@ func (c *RestClient) ReplaceOfferForResource(rid string, ru, maxru int) *RespRep
}
params["content"] = content
req := c.buildJsonRequest(method, url, params)
req = c.addAuthHeader(req, method, "offers", getResult.OfferInfo.Rid)
/*
* [btnguyen2k] 2022-02-16
* OfferInfo.Rid is returned from the server, but it _must_ be lower-cased when we send back to the server for
* issuing the 'replace-offer' request.
* Not sure if this is intended or a bug of CosmosDB.
*/
req = c.addAuthHeader(req, method, "offers", strings.ToLower(getResult.OfferInfo.Rid))
for k, v := range headers {
req.Header.Set(k, v)
}
Expand Down
2 changes: 1 addition & 1 deletion restclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ func TestRestClient_QueryAllDocuments(t *testing.T) {
fmt.Printf("\t%s - total RU charged: %0.3f\n", name+"/Insert", totalRu)

query := QueryReq{DbName: dbname, CollName: collname, MaxItemCount: 10, ConsistencyLevel: "Session", SessionToken: sessionToken,
Query: "SELECT * FROM c",
Query: "SELECT * FROM c",
CrossPartitionEnabled: true,
}
var result *RespQueryDocs
Expand Down

0 comments on commit 6ca74d7

Please sign in to comment.