mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
fix(headers): fixed & optimized clear method; (#5507)
This commit is contained in:
@@ -174,8 +174,20 @@ class AxiosHeaders {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
clear() {
|
||||
return Object.keys(this).forEach(this.delete.bind(this));
|
||||
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;
|
||||
}
|
||||
|
||||
normalize(format) {
|
||||
|
||||
Reference in New Issue
Block a user