Ajax request with DELETE method not working


#1

I am converting an ajax request into the Framework7 request API. The two are pretty much identical in terms of how they work so I haven’t had any problems so far. I have one request that is a DELETE which does not seem to be working properly. (NOTE that fw7 is the variable name I use for the Framework7 instance).

fw7.request({
url: “http://www.MyServer.com/Request_Name”,
method: “DELETE”,
contentType: “application/json”,
headers: {
Authorization: MyToken
},
data: JSON.stringify(requestObj),
Success and Error functions…
});

Instead of putting the data in the request body it takes the data and shoves it in request URL as query data and also neglects to set the Content-Type header.

http://www.MyServer.com/Request_Name?{"userID":"MyUserID","password":"MyPassword"}

If I change the request to a POST without touching anything else it properly formats and sends the request. DELETE requests are allowed to have a body according to spec, and the endpoint is specifically looking for the request to have a DELETE method. Did I miss something here?


#2

https://tools.ietf.org/html/rfc7231#section-4.3.5

A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request.

Maybe it is not solid spec, but anyway OPTIONS, DELETE, HEAD requests in f7 are handled as GET requests and request body is not supported on them.