MobileFirst HTTP Adapter:删除/更新后端cookie值 [英] MobileFirst HTTP Adapter: delete/update back-end cookie value

查看:151
本文介绍了MobileFirst HTTP Adapter:删除/更新后端cookie值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的适配器中多次使用 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.


  1. 我的第一个请求获得set-cookie:name = value1; Path = /回复标题

  2. 我的第二个请求设置标题:{cookie:'name = value2'}

  3. 第二个请求使用以下标头到达服务器cookie:name = value2,name = value1

  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"


推荐答案

将您 invokeHttp 改为以下

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

其中 myCookieValue 是你的变量

这篇关于MobileFirst HTTP Adapter:删除/更新后端cookie值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆