net/http/httputil: make TestDumpRequest idempotent
net/http/httputil: make TestDumpRequest idempotent

TestDumpRequest was failing with -count=2 or more
because for test cases that involved mustReadRequest,
the body was created as a *bufio.Reader. DumpRequest
and DumpRequestOut would then read the body until EOF
and would close it after use.
However, on re-runs of the test, the body would
be terminally exhausted and result in an unexpected
error "http: invalid Read on closed Body".

The update to the test cases adds an extra field "GetReq"
which allows us to construct requests per run of the tests
and hence make the test indefinitely re-runnable/idempotent.
"Req" or "GetReq" are mutually exclusive: either one of them
can be set or nil, but not both.

Fixes #26858

Change-Id: Ice3083dac1aa3249da4afc7075cd984eb159530d
Reviewed-on: https://go-review.googlesource.com/c/153377
Run-TryBot: Emmanuel Odeke <277f8eaa8c7dfbc55c17bf5e30561c1a9c45c569@gmail.com>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Brad Fitzpatrick <ae9783c0b0efc69cd85ab025ddd17aa44cdc4aa5@golang.org>

nawawi/go,cloudflare/go,cloudflare/go,golang/go,CAFxX/go,golang/go,josharian/go,golang/go,cloudflare/go,cloudflare/go,CAFxX/go,josharian/go,nawawi/go,CAFxX/go,golang/go,cloudflare/go,akutz/go,akutz/go,CAFxX/go,cloudflare/go,akutz/go,akutz/go,josharian/go,nawawi/go,nawawi/go,golang/go,akutz/go,cloudflare/go,nawawi/go,nawawi/go,josharian/go,golang/go,golang/go,akutz/go,CAFxX/go,CAFxX/go,akutz/go,nawawi/go,CAFxX/go,CAFxX/go,golang/go,akutz/go,josharian/go,nawawi/go,josharian/go,josharian/go,cloudflare/go,josharian/go