uni.addInterceptor("request", {
success({ data, statusCode, header, cookies }) {
console.log({ header });
}
});
const res = await uni.request({url:"/foo"})
- 发布:2023-05-30 11:13
- 更新:2024-02-29 17:28
- 阅读:714
产品分类: uniapp/H5
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
浏览器平台: Chrome
浏览器版本: 113
项目创建方式: CLI
CLI版本号: 3.0.0-alpha-308032023052300
示例代码:
操作步骤:
uni.addInterceptor("request", {
success({ data, statusCode, header, cookies }) {
console.log({ header });
}
});
const res = await uni.request({url:"/foo"})
uni.addInterceptor("request", {
success({ data, statusCode, header, cookies }) {
console.log({ header });
}
});
const res = await uni.request({url:"/foo"})
预期结果:
控制台header应该包括set-cookie
控制台header应该包括set-cookie
实际结果:
实际
access-control-allow-headers
:
"*"
access-control-allow-methods
:
"GET, POST, OPTIONS"
access-control-allow-origin
:
"*"
cache-control
:
"no-store"
connection
:
"close"
content-encoding
:
"gzip"
content-type
:
"text/plain; charset=utf-8"
date
:
"Tue, 30 May 2023 03:06:56 GMT"
server
:
"openresty/1.21.4.1"
transfer-encoding
:
"chunked"
vary
:
"Accept-Encoding"
实际
access-control-allow-headers
:
"*"
access-control-allow-methods
:
"GET, POST, OPTIONS"
access-control-allow-origin
:
"*"
cache-control
:
"no-store"
connection
:
"close"
content-encoding
:
"gzip"
content-type
:
"text/plain; charset=utf-8"
date
:
"Tue, 30 May 2023 03:06:56 GMT"
server
:
"openresty/1.21.4.1"
transfer-encoding
:
"chunked"
vary
:
"Accept-Encoding"
bug描述:
看图1和图2