mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
fix axios.delete ignores config.data (#3282)
Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
+2
-1
@@ -75,7 +75,8 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
|||||||
Axios.prototype[method] = function(url, config) {
|
Axios.prototype[method] = function(url, config) {
|
||||||
return this.request(mergeConfig(config || {}, {
|
return this.request(mergeConfig(config || {}, {
|
||||||
method: method,
|
method: method,
|
||||||
url: url
|
url: url,
|
||||||
|
data: (config || {}).data
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -43,6 +43,17 @@ describe('requests', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should allow data', function (done) {
|
||||||
|
axios.delete('/foo', {
|
||||||
|
data: { foo: 'bar' }
|
||||||
|
});
|
||||||
|
|
||||||
|
getAjaxRequest().then(function (request) {
|
||||||
|
expect(request.params).toBe(JSON.stringify({ foo: 'bar' }));
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should make an http request', function (done) {
|
it('should make an http request', function (done) {
|
||||||
axios('/foo');
|
axios('/foo');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user