### Describe the bug

AxiosError: unexpected end of file

Was not present before 1.2.1

### To Reproduce

_No response_

### Code snippet

_No response_

### Expected behavior

_No response_

### Axios Version

1.2.1

### Adapter Version

_No response_

### Browser

_No response_

### Browser Version

_No response_

### Node.js Version

_No response_

### OS

_No response_

### Additional Library Versions

_No response_

### Additional context/Screenshots

_No response_
test/unit/adapters/http.js
res.on('end', function () {
            response.end();
          });
        });
      }).listen(4000, function () {
        var configBeforeRedirectCount = 0;
        axios.get('http://localhost:4444/', {
          proxy: {
            host: 'localhost',
            port: 4000
          },
          maxRedirects: totalRedirectCount,
          beforeRedirect: function (options) {
            configBeforeRedirectCount += 1;
          }
        }).then(function (res) {
          assert.equal(totalRedirectCount, configBeforeRedirectCount, 'should invoke config.beforeRedirect option on every redirect');
          assert.equal(totalRedirectCount + 1, proxyUseCount, 'should go through proxy on every redirect');
          done();
        }).catch(done);
      });
    });
  });
  it('should preserve the HTTP verb on redirect', function (done) {
    server = http.createServer(function (req, res) {
      if (req.method.toLowerCase() !== "head") {
        res.statusCode = 400;
        res.end();
        return;
      }