Skip to content

Commit

Permalink
Merge pull request #13 from btnguyen2k/fix_change_offer_collection
Browse files Browse the repository at this point in the history
fix a bug in function caused by a change from v0.1.5
  • Loading branch information
btnguyen2k authored Feb 16, 2022
2 parents 9d34850 + 6ca74d7 commit cb1293b
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 cb1293b

Please sign in to comment.