Reputation: 11734
For WorkLight applications I don't see some cookie headers being sent to the server for basic WL.Client.invokeProcedure calls. How do you properly add cookie headers? Ideally, these would be global but I read that there may be issues using WL.Client.addGlobalHeader("Cookie"). procedure).
This is basically the code in Javascript:
var invocationData = {
adapter : "data",
procedure : procedure,
headers : { "Cookie", "CookieData=val" }
parameters : parms,
};
WL.Client.invokeProcedure(invocationData)
Edited: http://www-01.ibm.com/support/docview.wss?uid=swg21678099 "The WL.Client.addGlobalHeader API replaces the entire 'Cookie' header and destroys the session state."
Upvotes: 1
Views: 495
Reputation: 681
MFP 7.0.0 added a new API - WL.Client.setCookie()
.
A usage example:
WL.Client.setCookie({
name: 'cookieName',
value: 'cookieValue',
domain: 'google.com',
path: '/', // all paths
expires: 0 // never expires
}).then(function() {
// callbacks go here
});
Upvotes: 0
Reputation: 1225
Right now there is no way to add your own cookies to Worklight requests. Like your edit says, any Cookie header added using addGlobalHeader() gets replaced with only the cookies WL adds.
A feature request has been opened to see if this functionality could be added in future versions.
Upvotes: 1