Reputation: 59
I want to determine the size of the response. it's easy way to get the contentsize by resp.ContentLength. But, Size is the combined size of the response headers (usually a few hundred bytes) plus the response body, as delivered by the server. how can I get the size of the response headers ? Or Is there anyway to get the size of the response directly?
Upvotes: 5
Views: 7875
Reputation: 79604
You can implement an http.ResponseWriter
that counts the bytes it writes. It should be pretty simple to create your own, or you can use an existing library like this one.
Upvotes: 1