I am trying to add some low level tracing to a client app to validate the responses coming from a SaaS platform.
When I use either http's resp.Write(os.Stderr) or httputil.DumpResponse(resp, true) I see a hex content length immediately before the body and a literal "0" on a line after,
i.e. using a local copy of the doc example for DumpResponse() but with a real URL and outputting "string(dump)" instead of quotes bytes) to a local server I get (HTML between open/close removed for brevity):
---
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Connection: keep-alive
Content-Type: text/html
Date: Fri, 13 Sep 2024 13:05:33 GMT
Etag: W/"62136b7a-d2"
Last-Modified: Mon, 21 Feb 2022 10:37:46 GMT
Server: nginx/1.27.0
d2
<!DOCTYPE HTML>
<html>
...
</html>
0
---
The "d2" is the content length and the "0" is extra. Compared against Postman and curl on the command line, to be sure.
Is this expected by undocumented or have I missed something please?