-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
项目内部路由跳转按需加载的文件无法传递cookie #341
Comments
提供可复现的仓库 |
仓库地址:https://github.com/PhoenixAve/qiankun-cookie 修改内容(/main/index.js)主要就是在注册项目时传递了fetch,其他的跟仓库/example下代码一样 document.cookie = 'name=jack;password=123'
registerMicroApps([...], {}, {
fetch: (url) => {
return fetch(url, {
credentials: 'include',
mode: 'cors'
})
}
}) |
在"dynamicHeadAppend.ts"文件的97行中找到"execScripts"函数的调用,此时传递了三个参数,并没有传递自定义的fetch函数,所以在"execScripts"函数内部会采用"defaultFetch",最终没有传递cookie到服务器,并且获取js文件时,content-type的值不正确,截图如下: qiankun/src/hijackers/dynamicHeadAppend.ts文件第97行代码如下 ...
execScripts(null, [src], proxy).then(
...
) import-html-entry/src/index.js中第98行 export function execScripts(entry, scripts, proxy = window, opts = {}) {
const { fetch = defaultFetch } = opts;
...
} |
问题描述
注册项目时自定义了fetch方法,设置credentials为'include',但是项目内部路由跳转页面后获取按需加载的文件时没有携带cookie
相关环境信息
qiankun 版本 1.4.5
The text was updated successfully, but these errors were encountered: