Control the http sending of Accept-Encoding?

1,276 views
Skip to first unread message

jimr

unread,
Aug 26, 2011, 3:35:52 PM8/26/11
to golan...@googlegroups.com
Folks,

I'd like to be able to control an http request's Accept-Encoding
header, specifically I'd like to *not* send

  'Accept-Encoding: gzip'

for some specific operations I run.  It doesn't appear as though
I can accomplish this by using req.Header.Del.  Is there some
other way I can gain control over this header?

Looking at the http package code it appears as though I might
in some way construct my own http.Client and override the
Transport to disable compression, but it's not initially clear to
me if that's correct or how to do so properly.

Is someone here able point me at the relevant code?

Jim

jimr

unread,
Aug 26, 2011, 3:44:48 PM8/26/11
to golan...@googlegroups.com
Ah, reading a bit more of the code, is something like this supposed
to be how we handle it?

        ...
client := &http.Client{}
        transport := &http.Transport{Proxy: http.ProxyFromEnvironment} 
transport.DisableCompression = true
client.Transport = transport

        rsp, err := client.Do(req)


Jim

Reply all
Reply to author
Forward
0 new messages