Skip to content

Commit

Permalink
fix axios.delete ignores config.data (#3282)
Browse files Browse the repository at this point in the history
Co-authored-by: Jay <jasonsaayman@gmail.com>
  • Loading branch information
chinesedfan and jasonsaayman committed Oct 1, 2020
1 parent b7e954e commit fa36737
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/core/Axios.js
Expand Up @@ -75,7 +75,8 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
Axios.prototype[method] = function(url, config) {
return this.request(mergeConfig(config || {}, {
method: method,
url: url
url: url,
data: (config || {}).data
}));
};
});
Expand Down
11 changes: 11 additions & 0 deletions test/specs/requests.spec.js
Expand Up @@ -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) {
axios('/foo');

Expand Down

0 comments on commit fa36737

Please sign in to comment.