这是请求和回复:
Request
Header: AUTHORIZATION:WayXwJYTTTJaYfv2
Response
200 (OK)
Content-Type: application/json
{
"status": "OK"
}
我的api电话:
exports.APIDeleteRequest = function(url, callback, errorCallback) {
Ti.API.info('Delete Request is called');
var req = Titanium.Network.createHTTPClient({
onload : callback,
onerror : errorCallback,
timeout : 60000
});
req.open("DELETE", url);
req.setRequestHeader('Header: AUTHORIZATION', Alloy.Globals.authToken);
req.send();
};
我不确定在这种情况下我设置Request标头的方式是否正确。有人可以证实,谢谢。
答案 0 :(得分:1)
应该是:
req.open("DELETE", url);
req.setRequestHeader('AUTHORIZATION', Alloy.Globals.authToken);
req.send();