1

This is the request and response:

Request

Header: AUTHORIZATION:WayXwJYTTTJaYfv2

Response

200 (OK)
Content-Type: application/json
{
    "status": "OK"
}

My api call:

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();
};

I am not sure if the way I have set the Request header is the right way under these circumstances. Could someone confirm, thanks.

1 Answer 1

1

It should be:

req.open("DELETE", url);
req.setRequestHeader('AUTHORIZATION', Alloy.Globals.authToken);
req.send();
1
  • 1
    This works, however if you remove the Header it will fail. So the way I ended up having to fix it was to add a space between authorisation and the auth token Jul 16, 2014 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.