Cannot customize Content-Type header on xhr() POST
arkusuma opened this issue · comments
Anugrah Redja Kusuma commented
My web service was strictly accepting request with Content-Type: application/json
I cannot get that kind of header in XUI. The code below always produce
Content-Type: application/x-www-form-urlencoded, application/json
Code:
x$("#result").xhr("/mobile.asmx/arsip", {
method: "post",
async: true,
data: '{"hal": 1}',
headers: { "Content-Type": "application/json" },
});
jerose commented
This means it wont work with Yahoo API's using direct OAuth since it requires a Content-Type of "application/json" on POST also. Would seem better to have "application/x-www-form-urlencoded" there only as a default content type on POST, but allow it to be overwritten.