Skip to content
Closed
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
10 changes: 7 additions & 3 deletions storage/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,12 @@ func (t *Table) queryEntities(uri string, headers map[string]string, ml Metadata
return nil, err
}
v := originalURI.Query()
v.Set(nextPartitionKeyQueryParameter, contToken.NextPartitionKey)
v.Set(nextRowKeyQueryParameter, contToken.NextRowKey)
if contToken.NextPartitionKey != "" {
v.Set(nextPartitionKeyQueryParameter, contToken.NextPartitionKey)
}
if contToken.NextRowKey != "" {
v.Set(nextRowKeyQueryParameter, contToken.NextRowKey)
}
newURI := t.tsc.client.getEndpoint(tableServiceName, t.buildPath(), v)
entities.NextLink = &newURI
entities.ml = ml
Expand All @@ -371,7 +375,7 @@ func extractContinuationTokenFromHeaders(h http.Header) *continuationToken {
NextRowKey: h.Get(headerNextRowKey),
}

if ct.NextPartitionKey != "" && ct.NextRowKey != "" {
if ct.NextPartitionKey != "" || ct.NextRowKey != "" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it ever be the case that NextRowKey is not empty but NextParitionKey is?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Storage docs didn't specifically mention if NextParitionKey could be empty, but it's a valid query to storage to have just NextRowKey.

Also from how other SDKs handle it, these three pagination headers NextTableName, NextPartitionKey, and NextRowKey don't have dependencies on each other. The non-empty ones will be added to the URL of the next request.

return &ct
}
return nil
Expand Down