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

Adding support for URLSearchParams

This commit is contained in:
Nick Uraltsev
2016-05-07 12:26:28 -07:00
parent ea375220a2
commit f20490eb6b
10 changed files with 108 additions and 20 deletions
+15
View File
@@ -1,3 +1,5 @@
var URLSearchParams = require('url-search-params');
describe('requests', function () {
beforeEach(function () {
jasmine.Ajax.install();
@@ -277,4 +279,17 @@ describe('requests', function () {
});
});
it('should support URLSearchParams', function (done) {
var params = new URLSearchParams();
params.append('param1', 'value1');
params.append('param2', 'value2');
axios.post('/foo', params);
getAjaxRequest().then(function (request) {
expect(request.requestHeaders['Content-Type']).toBe('application/x-www-form-urlencoded;charset=utf-8');
expect(request.params).toBe('param1=value1&param2=value2');
done();
});
});
});