2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

Fixing content-type header repeated (#4745)

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
João Gabriel Quaresma
2022-05-28 06:52:50 -03:00
committed by GitHub
parent a11f9501b8
commit 1504792765
2 changed files with 24 additions and 0 deletions
+20
View File
@@ -177,4 +177,24 @@ describe('transform', function () {
done();
});
});
it('should normalize \'content-type\' header when using a custom transformRequest', function (done) {
var data = {
foo: 'bar'
};
axios.post('/foo', data, {
headers: { 'content-type': 'application/x-www-form-urlencoded' },
transformRequest: [
function () {
return 'aa=44'
}
]
});
getAjaxRequest().then(function (request) {
expect(request.requestHeaders['Content-Type']).toEqual('application/x-www-form-urlencoded');
done();
});
});
});