aboutsummaryrefslogtreecommitdiff
path: root/internal/middleware/accept_requests_test.go
diff options
context:
space:
mode:
authorHana Kim <hyangah@gmail.com>2026-03-05 22:48:28 -0500
committerHyang-Ah Hana Kim <hyangah@gmail.com>2026-03-26 14:11:53 -0700
commit81ffb8b9704ea4f04dfc06ccb3300d236e8aeef2 (patch)
tree96dd18e795d7faa1a9b28ac23eaadfab3e86c5a2 /internal/middleware/accept_requests_test.go
parent98258ff769bbca6f3d004ce80fabf5bff8f1136c (diff)
downloadgo-x-pkgsite-81ffb8b9704ea4f04dfc06ccb3300d236e8aeef2.tar.xz
all: run go fix -stringsbuilder
Change-Id: I839e47c2b39ee592909f7ecb03603d4fb1d1954b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/753430 Reviewed-by: Jonathan Amsterdam <jba@google.com> kokoro-CI: kokoro <noreply+kokoro@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'internal/middleware/accept_requests_test.go')
-rw-r--r--internal/middleware/accept_requests_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/middleware/accept_requests_test.go b/internal/middleware/accept_requests_test.go
index 24f5fa19..e1971bac 100644
--- a/internal/middleware/accept_requests_test.go
+++ b/internal/middleware/accept_requests_test.go
@@ -7,6 +7,7 @@ package middleware
import (
"net/http"
"net/http/httptest"
+ "strings"
"testing"
)
@@ -62,20 +63,20 @@ func TestAcceptRequests_URILength(t *testing.T) {
defer ts.Close()
c := ts.Client()
- var longURL string
+ var longURL strings.Builder
// Create a URL with 990 characters.
numParts := maxURILength/2 - 5
for range numParts {
- longURL += "/a"
+ longURL.WriteString("/a")
}
// Without this query param, the length of longURL will be < maxURILength.
- longURL += "?q=randomstring"
+ longURL.WriteString("?q=randomstring")
for _, test := range []struct {
name, urlPath string
want bool
}{
{"short URL", "/shorturlpath", true},
- {"long URL", longURL, false},
+ {"long URL", longURL.String(), false},
} {
called = false
req, err := http.NewRequest(http.MethodGet, ts.URL+test.urlPath, nil)