Http Delete Request Without Body
I am facing the same problem as mentioned here: I am trying to connect my ExtJS 4.1 store with REST API, but when I delete the record from the store and consequently invoke HTTP DE
Solution 1:
There is a workaround based on AJAX interceptor, inspired by this link. This code solves the problem regardless of the framework used, so it can be also useful for other people who are not necessarily using Ext JS:
(function(XHR) {
"use strict";
var open = XHR.prototype.open;
var send = XHR.prototype.send;
var httpMethod;
XHR.prototype.open = function(method, url, async, user, pass) {
httpMethod = method;
this._url = url;
open.call(this, method, url, async, user, pass);
};
XHR.prototype.send = function(data) {
if(httpMethod === 'DELETE')
{
data = null;
}
send.call(this, data);
}
})(XMLHttpRequest);
Post a Comment for "Http Delete Request Without Body"