### Describe the bug

https://github.com/developer-choi/axios-error-report

TypeError is occurred (in 1.6.6 version)

<img width="184" alt="image" src="https://github.com/axios/axios/assets/51902362/1f7f6e7f-8c8b-4ef7-9854-5c08f572d58b">

<img width="171" alt="image" src="https://github.com/axios/axios/assets/51902362/36042439-a071-485e-b696-9f2c01849759">

### To Reproduce

https://github.com/developer-choi/axios-error-report

### Code snippet

_No response_

### Expected behavior

_No response_

### Axios Version

1.6.6

### Adapter Version

_No response_

### Browser

CHROME

### Browser Version

120.0.6099.225

### Node.js Version

20.11.0

### OS

Window 11
test/unit/adapters/http.js
password: 'pass'
            }
          },
          headers: {
            'Proxy-Authorization': 'Basic abc123'
          }
        }).then(function (res) {
          var base64 = Buffer.from('user:pass', 'utf8').toString('base64');
          assert.equal(res.data, 'Basic ' + base64, 'should authenticate to the proxy');
          done();
        }).catch(done);
      });
    });
  });
  context('different options for direct proxy configuration (without env variables)', () => {
    const destination = 'www.example.com';
    const testCases = [{
      description: 'hostname and trailing colon in protocol',
      proxyConfig: { hostname: '127.0.0.1', protocol: 'http:', port: 80 },
      expectedOptions: { host: '127.0.0.1', protocol: 'http:', port: 80, path: destination }
    }, {
      description: 'hostname and no trailing colon in protocol',
      proxyConfig: { hostname: '127.0.0.1', protocol: 'http', port: 80 },
      expectedOptions: { host: '127.0.0.1', protocol: 'http:', port: 80, path: destination }
    }, {
      description: 'both hostname and host -> hostname takes precedence',
      proxyConfig: { hostname: '127.0.0.1', host: '0.0.0.0', protocol: 'http', port: 80 },
      expectedOptions: { host: '127.0.0.1', protocol: 'http:', port: 80, path: destination }
    }, {
      description: 'only host and https protocol',