feat(pagination): make sure the URL to in the link header is inside angle brackets (#2116)

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
This commit is contained in:
Andrei Aaron
2023-12-06 19:54:47 +02:00
committed by GitHub
parent e3bd9a8fa8
commit f321fa91fe
3 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -7303,7 +7303,7 @@ func TestListingTags(t *testing.T) {
} else if testCase.expectedTags[len(testCase.expectedTags)-1] == alltags[len(alltags)-1] {
So(actualLinkValue, ShouldEqual, "")
} else {
expectedLinkValue := fmt.Sprintf("/v2/%s/tags/list?n=%s&last=%s; rel=\"next\"",
expectedLinkValue := fmt.Sprintf("</v2/%s/tags/list?n=%s&last=%s>; rel=\"next\"",
repoName, testCase.pageSize, tags.Tags[len(tags.Tags)-1],
)
So(actualLinkValue, ShouldEqual, expectedLinkValue)
+1 -1
View File
@@ -375,7 +375,7 @@ func (rh *RouteHandler) ListTags(response http.ResponseWriter, request *http.Req
stopIndex = startIndex + numTags - 1
response.Header().Set(
"Link",
fmt.Sprintf("/v2/%s/tags/list?n=%d&last=%s; rel=\"next\"",
fmt.Sprintf("</v2/%s/tags/list?n=%d&last=%s>; rel=\"next\"",
name,
numTags,
tags[stopIndex],