http2, webdav, websocket: fix %q verb uses with wrong type

Caught early by the improved vet check gated behind the 1.26 language
version combined with a tiplang builder that tests with 1.26 language
version.

Fixes golang/go#76574.
Fixes golang/go#76599.
Fixes golang/go#76547.

Change-Id: If8e2266013df0a39fc980a1e9287f8cb75949811
Cq-Include-Trybots: luci.golang.try:x_net-gotip-linux-amd64-tiplang
Reviewed-on: https://go-review.googlesource.com/c/net/+/725220
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
This commit is contained in:
Dmitri Shuralyov
2025-11-28 12:06:56 -05:00
committed by Gopher Robot
parent ec11eccf5a
commit 7c360367ab
4 changed files with 8 additions and 8 deletions

View File

@@ -1977,7 +1977,7 @@ func TestServerRejectsContentLengthWithSignNewRequests(t *testing.T) {
}
checkReq := func(r *http.Request) {
if r.ContentLength != tt.wantCL {
t.Fatalf("Got: %q\nWant: %q", r.ContentLength, tt.wantCL)
t.Fatalf("Got: %d\nWant: %d", r.ContentLength, tt.wantCL)
}
}
testServerRequest(t, writeReq, checkReq)

View File

@@ -556,7 +556,7 @@ func TestMemPS(t *testing.T) {
sort.Sort(byStatus(propstats))
sort.Sort(byStatus(op.wantPropstats))
if !reflect.DeepEqual(propstats, op.wantPropstats) {
t.Errorf("%s: propstat\ngot %q\nwant %q", desc, propstats, op.wantPropstats)
t.Errorf("%s: propstat\ngot %#v\nwant %#v", desc, propstats, op.wantPropstats)
}
}
}

View File

@@ -190,7 +190,7 @@ Sec-WebSocket-Version: 13
t.Errorf("handshake failed: %v", err)
}
if code != http.StatusSwitchingProtocols {
t.Errorf("status expected %q but got %q", http.StatusSwitchingProtocols, code)
t.Errorf("status expected %d but got %d", http.StatusSwitchingProtocols, code)
}
expectedProtocols := []string{"chat", "superchat"}
if fmt.Sprintf("%v", config.Protocol) != fmt.Sprintf("%v", expectedProtocols) {
@@ -239,10 +239,10 @@ Sec-WebSocket-Version: 13
t.Errorf("handshake failed: %v", err)
}
if code != http.StatusSwitchingProtocols {
t.Errorf("status expected %q but got %q", http.StatusSwitchingProtocols, code)
t.Errorf("status expected %d but got %d", http.StatusSwitchingProtocols, code)
}
if len(config.Protocol) != 0 {
t.Errorf("len(config.Protocol) expected 0, but got %q", len(config.Protocol))
t.Errorf("len(config.Protocol) expected 0, but got %d", len(config.Protocol))
}
b := bytes.NewBuffer([]byte{})
bw := bufio.NewWriter(b)
@@ -285,7 +285,7 @@ Sec-WebSocket-Version: 9
t.Errorf("handshake expected err %q but got %q", ErrBadWebSocketVersion, err)
}
if code != http.StatusBadRequest {
t.Errorf("status expected %q but got %q", http.StatusBadRequest, code)
t.Errorf("status expected %d but got %d", http.StatusBadRequest, code)
}
}
@@ -583,7 +583,7 @@ Sec-WebSocket-Version: 13
t.Errorf("handshake failed: %v", err)
}
if code != http.StatusSwitchingProtocols {
t.Errorf("status expected %q but got %q", http.StatusSwitchingProtocols, code)
t.Errorf("status expected %d but got %d", http.StatusSwitchingProtocols, code)
}
b := bytes.NewBuffer([]byte{})
bw := bufio.NewWriter(b)

View File

@@ -323,7 +323,7 @@ func TestHTTP(t *testing.T) {
return
}
if resp.StatusCode != http.StatusBadRequest {
t.Errorf("Get: expected %q got %q", http.StatusBadRequest, resp.StatusCode)
t.Errorf("Get: expected %d got %d", http.StatusBadRequest, resp.StatusCode)
}
}