net/http: fix triv.go

CL 428137 replaced 'buf := make(bytes.Buffer)' with 'var buf strings.Builder'.
That change also requires passing &buf to io.Copy instead of buf.

Change-Id: I72b3faa46693e7d1441298f49dc6b95859c3bff3
Reviewed-on: https://go-review.googlesource.com/c/go/+/449635
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
This commit is contained in:
Russ Cox 2022-11-10 15:26:27 -05:00
parent 1b03568ae1
commit 4d37f96825
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ func (ctr *Counter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
ctr.n++
case "POST":
var buf strings.Builder
io.Copy(buf, req.Body)
io.Copy(&buf, req.Body)
body := buf.String()
if n, err := strconv.Atoi(body); err != nil {
fmt.Fprintf(w, "bad POST: %v\nbody: [%v]\n", err, body)