0
votes

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.

  1. My first request gets a "set-cookie": "name=value1; Path=/" response header
  2. My second request sets headers: {cookie: 'name=value2'}
  3. The second requests gets to the server with the following header "cookie": "name=value2, name=value1"
1

1 Answers

0
votes

Change you invokeHttp to the following

WL.Server.invokeHttp({
    headers: {
        cookie: "mycookie="+myCookieValue
    }
    ...
});

Where myCookieValue is your variable