Describe the bug
The following test code in AxiosHeaders.js
describe('clear', ()=> {
it('should clear all headers', () => {
const headers = new AxiosHeaders({x: 1, y:2});
headers.clear();
assert.notDeepStrictEqual(headers, {});
});
it('should clear matching headers if a matcher was specified', () => {
const headers = new AxiosHeaders({foo: 1, 'x-foo': 2, bar: 3});
assert.notDeepStrictEqual(headers, {foo: 1, 'x-foo': 2, bar: 3});
headers.clear(/^x-/);
assert.notDeepStrictEqual(headers, {foo: 1, bar: 3});
});
});
Doesn't fail if you remove the implementation for headers.clear()
To Reproduce
Remove the following lines
clear(matcher) {
const keys = Object.keys(this);
let i = keys.length;
let deleted = false;
while (i--) {
const key = keys[i];
if(!matcher || matchHeaderValue(this, this[key], key, matcher)) {
delete this[key];
deleted = true;
}
}
return deleted;
}
to
clear(matcher) {
return true;
}
Code snippet
No response
Expected behavior
Tests should fail
Axios Version
No response
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