2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +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
+15
View File
@@ -42,6 +42,21 @@ describe('headers', function () {
});
});
it('should not set header if value is null', function (done) {
expect(axios.defaults.headers.common['Accept']).toEqual('application/json, text/plain, */*');
axios('/foo', {
headers: {
Accept: null
}
});
getAjaxRequest().then(function (request) {
expect(typeof request.requestHeaders['Accept']).toEqual('undefined');
done();
});
});
it('should add extra headers for post', function (done) {
var headers = axios.defaults.headers.common;