问题
I'm using WL.Server.invokeHttp(options) several times in my adapter. I need to have different values for a given cookie in different calls.
If I call
WL.Server.invokeHttp({cookies: {
mycookie: 'firstValue'
}
...
the back-end gets this header "cookie": "mycookie=firstValue", as expected.
If I later want to make another call with a different cookie value,
WL.Server.invokeHttp({cookies: {
mycookie: 'secondValue'
}
...
the back-end gets this header "cookie": "mycookie=firtsValue; mycookie=secondValue".
Is there some way that will let me forget a previous value of the cookie?
Update 2015/02/27
Using the headers option instead of the cookies option, as suggested by @YoelNunez, does not solve it.
- My first request gets a
"set-cookie": "name=value1; Path=/"response header - My second request sets
headers: {cookie: 'name=value2'} - The second requests gets to the server with the following header
"cookie": "name=value2, name=value1"
回答1:
Change you invokeHttp to the following
WL.Server.invokeHttp({
headers: {
cookie: "mycookie="+myCookieValue
}
...
});
Where myCookieValue is your variable
来源:https://stackoverflow.com/questions/28753979/mobilefirst-http-adapter-delete-update-back-end-cookie-value