Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1787

Get size of http.Request

$
0
0

In my application, I would like to register how many bytes are transferred down the wire by my HTTP client, to keep this metric under control.

I could not find a way to accomplish this easily. The http.Request objects have a convenient method Write which fills a buffer with the HTTP packet that would travel over the network, but if I call this then the body gets close, and calling http.Client.Do on this request does not send the right packet. Cloning the request did not help.

So here is my question: how can I obtain the size (in bytes) of the request I'm about to send (or that I just sent)? Is it possible to do this also for HTTPS connections?


Viewing all articles
Browse latest Browse all 1787

Trending Articles