task: metadata: install: pip install -e .[dev]
patch: diff --git a/vcr/filters.py b/vcr/filters.py
index 8e00b64..df3dd30 100644
--- a/vcr/filters.py
+++ b/vcr/filters.py
@@ -150,6 +150,8 @@ def decode_response(response):
         """Returns decompressed body according to encoding using zlib.
         to (de-)compress gzip format, use wbits = zlib.MAX_WBITS | 16
         """
+        if not body:
+            return ""
         if encoding == "gzip":
             return zlib.decompress(body, zlib.MAX_WBITS | 16)
         else:  # encoding == 'deflate'

problem_statement: [BUG] decode_compressed_response raises exception on empty responses.
```python
>>> import vcr
>>> import requests
>>> with vcr.use_cassette('/tmp/foo.yaml', decode_compressed_response=True):
...     requests.head('https://httpbin.org/gzip')
... 
Traceback (most recent call last):
  Input In [8] in <cell line: 1>
    requests.head('https://httpbin.org/gzip')
  File ~/.local/pipx/venvs/ipython/lib/python3.9/site-packages/requests/api.py:100 in head
    return request("head", url, **kwargs)
  File ~/.local/pipx/venvs/ipython/lib/python3.9/site-packages/requests/api.py:59 in request
    return session.request(method=method, url=url, **kwargs)
  File ~/.local/pipx/venvs/ipython/lib/python3.9/site-packages/requests/sessions.py:587 in request
    resp = self.send(prep, **send_kwargs)
  File ~/.local/pipx/venvs/ipython/lib/python3.9/site-packages/requests/sessions.py:701 in send
    r = adapter.send(request, **kwargs)
  File ~/.local/pipx/venvs/ipython/lib/python3.9/site-packages/requests/adapters.py:489 in send
    resp = conn.urlopen(
  File ~/.local/pipx/venvs/ipython/lib/python3.9/site-packages/urllib3/connectionpool.py:703 in urlopen
    httplib_response = self._make_request(
  File ~/.local/pipx/venvs/ipython/lib/python3.9/site-packages/urllib3/connectionpool.py:440 in _make_request
    httplib_response = conn.getresponse(buffering=True)
  File ~/.virtualenvs/tmp/lib/python3.9/site-packages/vcr/stubs/__init__.py:260 in getresponse
    self.cassette.append(self._vcr_request, response)
  File ~/.virtualenvs/tmp/lib/python3.9/site-packages/vcr/cassette.py:235 in append
    response = self._before_record_response(response)
  File ~/.virtualenvs/tmp/lib/python3.9/site-packages/vcr/config.py:176 in before_record_response
    response = function(response)
  File ~/.virtualenvs/tmp/lib/python3.9/site-packages/vcr/filters.py:168 in decode_response
    new_body = decompress_body(response["body"]["string"], encoding)
  File ~/.virtualenvs/tmp/lib/python3.9/site-packages/vcr/filters.py:154 in decompress_body
    return zlib.decompress(body, zlib.MAX_WBITS | 16)
error: Error -5 while decompressing data: incomplete or truncated stream
```
repo: kevin1024/vcrpy
test_cmd: pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
test_patch: diff --git a/tests/integration/test_filter.py b/tests/integration/test_filter.py
index b42bb34..da75f6d 100644
--- a/tests/integration/test_filter.py
+++ b/tests/integration/test_filter.py
@@ -106,6 +106,18 @@ def test_decompress_gzip(tmpdir, httpbin):
     assert_is_json(decoded_response)
 
 
+def test_decomptess_empty_body(tmpdir, httpbin):
+    url = httpbin.url + "/gzip"
+    request = Request(url, headers={"Accept-Encoding": ["gzip, deflate"]}, method="HEAD")
+    cass_file = str(tmpdir.join("gzip_empty_response.yaml"))
+    with vcr.use_cassette(cass_file, decode_compressed_response=True):
+        response = urlopen(request).read()
+    with vcr.use_cassette(cass_file) as cass:
+        decoded_response = urlopen(request).read()
+        assert_cassette_has_one_response(cass)
+    assert decoded_response == response
+
+
 def test_decompress_deflate(tmpdir, httpbin):
     url = httpbin.url + "/deflate"
     request = Request(url, headers={"Accept-Encoding": ["gzip, deflate"]})