如果有多个,则Axios仅返回最后一个“ set-cookie”

时间:2019-05-21 11:58:28

标签: react-native iis cookies axios

我在我的react-native应用程序中使用axios来调用rest api。响应api调用,服务器返回多个“ set-cookie”标头。但是axios只返回最后一个。

在Postman中尝试了相同的API,并按预期返回4个“ set-cookie”标头。在axios中,它总是最后一个而已

我已经完成axios.defaults.withCredentials = true;

我也尝试过像这样将其包含在请求配置中...

axios.request( {
...otherConfig,
withCredentials: true
})

如果我这样做...

axios.request({
            url: 'https://myurl.mydomain',
            method: 'post',
            headers: { 'Content-Type': 'application/json' },
            data: JSON.stringify(body),
            withCredentials: true,
        }).then(response => {
            console.log(response.headers['set-cookie'])
        });

我希望上面的console.log()写类似

set-cookie: ["lang=AR; expires=somedate; path=/",
            ".ASPXAUTH=authtoken-value; expires=somedate; path=/",
            "OtherCookie1=111; expires=Tue, 21-May-2019 19:59:59 GMT; path=/"]
            "OtherCookie2=222; expires=Tue, 21-May-2019 19:59:59 GMT; path=/"]

0 个答案:

没有答案