restful api集cookie标头未与请求标头一起传递到后端

3bygqnnd  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(195)

我正在使用spring项目和angularjs项目。我尝试使用angularjs更新set cookie头。但是,该值未设置为后端api。
我调试后端服务并检查通过请求头集cookie请求的值。更新后的值未退出。

myFunction: async (value1, value2, cookie) => {
        try {
            let header = null;
            if(cookie === null){
                header = {
                    'Content-Type': 'application/json'
                }
            }else{
                header = {
                    'Content-Type': 'application/json',
                    'Set-Cookie'  : 'YES'
                }
            }

            const { data } = await $http({
                method: 'POST',
                url: RestURIs.myrequest,
                headers: header,
                data: {
                    value1: value1,
                    value2: value2
                }
            });
            return data;
        } catch (error) {
            console.error('error on service');
            return $q.reject(error);
        }
    }

如果这是更新标题的错误方法。怎么做?请帮我确定我所做的事情?。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题