Hello every one,
I'd like to ask all of you how to control gzip compression when requesting HTTP Post messages.
"Accept-Encoding: gzip" as Http request headers was always added to http request I sent.
But I don't want to use gzip compression.
How can I manage that?
I've always used DisableCompression of transport type before executing http.NewRequest.
Just In case, I tried to set both of value true and false to DisableCompression.
But it could't work well so far.
Now I'm using version1.5 of golang.
My part of code sample is as below.
//gzip
tr := &http.Transport{
DisableCompression: true,
}
client := &http.Client{Transport: tr}
req, err := http.NewRequest(
"POST",
reqUrl,
bytes.NewBuffer(bytesMessage),
)
//Set Http Headers
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Accept", "*/*")
req.Header.Del("Accept-Encoding")
//HTTP request
resp, err := client.Do(req)
Thanks in advance.
Harry