aboutsummaryrefslogtreecommitdiff
path: root/vendor/google.golang.org/api/gensupport/send.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/google.golang.org/api/gensupport/send.go')
-rw-r--r--vendor/google.golang.org/api/gensupport/send.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/vendor/google.golang.org/api/gensupport/send.go b/vendor/google.golang.org/api/gensupport/send.go
index 3d22f63..092044f 100644
--- a/vendor/google.golang.org/api/gensupport/send.go
+++ b/vendor/google.golang.org/api/gensupport/send.go
@@ -5,6 +5,7 @@
package gensupport
import (
+ "errors"
"net/http"
"golang.org/x/net/context"
@@ -32,6 +33,11 @@ func RegisterHook(h Hook) {
// If ctx is non-nil, it calls all hooks, then sends the request with
// ctxhttp.Do, then calls any functions returned by the hooks in reverse order.
func SendRequest(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
+ // Disallow Accept-Encoding because it interferes with the automatic gzip handling
+ // done by the default http.Transport. See https://github.com/google/google-api-go-client/issues/219.
+ if _, ok := req.Header["Accept-Encoding"]; ok {
+ return nil, errors.New("google api: custom Accept-Encoding headers not allowed")
+ }
if ctx == nil {
return client.Do(req)
}