MobileFirst HTTP Adapter:删除/更新后端cookie值 [英] MobileFirst HTTP Adapter: delete/update back-end cookie value
问题描述
我在我的适配器中多次使用 WL.Server.invokeHttp(options)
。我需要在不同的调用中为给定的cookie提供不同的值。
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.
如果我打电话
WL.Server.invokeHttp({cookies: {
mycookie: 'firstValue'
}
...
后端获取此标头cookie:mycookie = firstValue
,如预期的那样。
the back-end gets this header "cookie": "mycookie=firstValue"
, as expected.
如果我以后想要使用不同的cookie值进行另一次调用,
If I later want to make another call with a different cookie value,
WL.Server.invokeHttp({cookies: {
mycookie: 'secondValue'
}
...
后面-end获取此标题cookie:mycookie = firtsValue; mycookie = secondValue
。
the back-end gets this header "cookie": "mycookie=firtsValue; mycookie=secondValue"
.
是否有一些这会让我忘记以前的cookie值?
Is there some way that will let me forget a previous value of the cookie?
更新2015/02/27
使用标题
选项而不是 cookies
选项,如@YoelNun所建议是的,没有解决它。
Using the headers
option instead of the cookies
option, as suggested by @YoelNunez, does not solve it.
- 我的第一个请求获得
set-cookie:name = value1; Path = /
回复标题 - 我的第二个请求设置
标题:{cookie:'name = value2'}
- 第二个请求使用以下标头到达服务器
cookie:name = value2,name = value1
- 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"
推荐答案
将您 invokeHttp
改为以下
WL.Server.invokeHttp({
headers: {
cookie: "mycookie="+myCookieValue
}
...
});
其中 myCookieValue
是你的变量
这篇关于MobileFirst HTTP Adapter:删除/更新后端cookie值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!