Repository: axios/axios (js)

Issue:
Cannot assign to read only property 'set' of object '[object Object]'  at setHeader
### Describe the bug

Sending a request to a specific link that in response, one of his header names is "Set" will cause an "uncaughtException" that cannot be avoided, even by using interceptors, since the `setHeader` called before the interceptors for the response handling.

```
TypeError: Cannot assign to read only property 'set' of object '[object Object]'\n    at setHeader 
(/app/node_modules/axios/dist/node/axios.cjs:1651:30)\n    at /app/node_modules/axios/dist/node/axios.cjs:1656:51\n    at 
Object.forEach (/app/node_modules/axios/dist/node/axios.cjs:293:10)\n    at setHeaders 
(/app/node_modules/axios/dist/node/axios.cjs:1656:13)\n    at AxiosHeaders.set 
(/app/node_modules/axios/dist/node/axios.cjs:1659:7)\n    at new AxiosHeaders 
```

### To Reproduce

Send a GET request to the following link: https://my424369.businessbydesign.cloud.sap/sap/public/ap/ui/repository/SAP_UI/HTMLOBERON5/client.html?app.component=/SAP_UI_CT/Main/root.uiccwoc&rootWindow=X&redirectUrl=/sap/public/byd/runtime&slalala=25

You will receive the error mentioned above.

### Code snippet

```js
axios.get('https://my424369.businessbydesign.cloud.sap/sap/public/ap/ui/repository/SAP_UI/HTMLOBERON5/client.html?app.component=/SAP_UI_CT/Main/root.uiccwoc&rootWindow=X&redirectUrl=/sap/public/byd/runtime&slalala=25')
```


### Expected behavior

_No response_

### Axios Version

1.4.0

### Adapter Version

_No response_

### Browser

_No response_

### Browser Version

_No response_

### Node.js Version

18.12.1

### OS

Windows 11

### Additional Library Versions

_No response_

### Additional context/Screenshots

#### Response Headers

![chrome_UdptZcbAHk](https://github.com/axios/axios/assets/21152343/75468974-403c-4573-9632-18c680bada1a)


Pull request description:
fix(headers): added support for setting header names that overlap with class methods;
Fixes #5768;

Maps reserved header names to their capitalized representation to avoid attempts to overwrite class methods.
`set` => `Set`
`get` => `Get`

Patch:
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index 11c8ad9..2b7e9f2 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -10,5 +10,6 @@ module.exports = {
     "sourceType": "module"
   },
   "rules": {
+    "no-cond-assign": 0
   }
 }
diff --git a/lib/core/AxiosHeaders.js b/lib/core/AxiosHeaders.js
index 361d340..558ad8f 100644
--- a/lib/core/AxiosHeaders.js
+++ b/lib/core/AxiosHeaders.js
@@ -282,7 +282,17 @@ class AxiosHeaders {
 
 AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
 
-utils.freezeMethods(AxiosHeaders.prototype);
+// reserved names hotfix
+utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
+  let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
+  return {
+    get: () => value,
+    set(headerValue) {
+      this[mapped] = headerValue;
+    }
+  }
+});
+
 utils.freezeMethods(AxiosHeaders);
 
 export default AxiosHeaders;
diff --git a/lib/utils.js b/lib/utils.js
index ccf31b1..a386b77 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -540,8 +540,9 @@ const reduceDescriptors = (obj, reducer) => {
   const reducedDescriptors = {};
 
   forEach(descriptors, (descriptor, name) => {
-    if (reducer(descriptor, name, obj) !== false) {
-      reducedDescriptors[name] = descriptor;
+    let ret;
+    if ((ret = reducer(descriptor, name, obj)) !== false) {
+      reducedDescriptors[name] = ret || descriptor;
     }
   });
 


Test patch:
diff --git a/test/unit/core/AxiosHeaders.js b/test/unit/core/AxiosHeaders.js
index 23f824e..bc75123 100644
--- a/test/unit/core/AxiosHeaders.js
+++ b/test/unit/core/AxiosHeaders.js
@@ -76,6 +76,17 @@ describe('AxiosHeaders', function () {
     })
   });
 
+  it('should support uppercase name mapping for names overlapped by class methods', () => {
+    const headers = new AxiosHeaders({
+      set: 'foo'
+    });
+
+    headers.set('get', 'bar');
+
+    assert.strictEqual(headers.get('Set'), 'foo');
+    assert.strictEqual(headers.get('Get'), 'bar');
+  });
+
   describe('get', function () {
     describe('filter', function() {
       it('should support RegExp', function () {