2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

Allow unsetting headers by passing null (#382) (#1845)

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Martti Laine
2020-06-04 20:57:54 +02:00
committed by GitHub
parent 4b3947aa59
commit 487941663b
4 changed files with 33 additions and 6 deletions
+7
View File
@@ -47,6 +47,13 @@ module.exports = function dispatchRequest(config) {
}
);
// Remove header where value is null
utils.forEach(config.headers, function deleteNullValueHeaders(value, key) {
if (value === null) {
delete config.headers[key];
}
});
var adapter = config.adapter || defaults.adapter;
return adapter(config).then(function onAdapterResolution(response) {