Fixes issue 104.
diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py
index 05cb5cf..81e9f93 100644
--- a/python2/httplib2/__init__.py
+++ b/python2/httplib2/__init__.py
@@ -1060,7 +1060,7 @@
conn = self.connections[conn_key] = connection_type(authority, timeout=self.timeout, proxy_info=self.proxy_info)
conn.set_debuglevel(debuglevel)
- if method in ["GET", "HEAD"] and 'range' not in headers and 'accept-encoding' not in headers:
+ if 'range' not in headers and 'accept-encoding' not in headers:
headers['accept-encoding'] = 'gzip, deflate'
info = email.Message.Message()
diff --git a/python2/httplib2test.py b/python2/httplib2test.py
index 1c5c49f..3dcfe03 100755
--- a/python2/httplib2test.py
+++ b/python2/httplib2test.py
@@ -703,6 +703,13 @@
self.assertEqual(int(response['content-length']), len("This is the final destination.\n"))
self.assertEqual(content, "This is the final destination.\n")
+ def testPostAndGZipResponse(self):
+ uri = urlparse.urljoin(base, "gzip/post.cgi")
+ (response, content) = self.http.request(uri, "POST", body=" ")
+ self.assertEqual(response.status, 200)
+ self.assertFalse(response.has_key('content-encoding'))
+ self.assertTrue(response.has_key('-content-encoding'))
+
def testGetGZipFailure(self):
# Test that we raise a good exception when the gzip fails
self.http.force_exception_to_status_code = False