Fixed the issue. Apparently, PUT requests are not normally created without a body. Thus, adding the line:
data: "{}",
fixed the problem.
Question
I am creating a phonegap app that needs to support android gingerbread. The gingerbread device cannot successfully make ajax requests to the service API. No other device appears to have this problem. I always get back:
HTTP Error 411. The request must be chunked or have a content length.
Some searching has indicated this is usually not a device-specific error. Here is the code I am using:
var addItemToList = function (itemId, successCallback, errorCallback) {
var address = appContext.createEndPointAddress("/List/" + itemId);
$.ajax({
type: 'PUT',
url: address,
dataType: "json",
success: successCallback,
error: errorCallback,
headers: {
"Authorization": appContext.getAuthHeader(),
Accept:
"application/site.error-ver1+json, application/site.success-ver1+json"
}
});
};
I am assuming it has to do with the request header formed by whatever browser gingerbread uses. What should I do to repair the faulty header?
Solution
Fixed the issue. Apparently, PUT requests are not normally created without a body. Thus, adding the line:
data: "{}",
fixed the problem.