We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
我在飞书小程序项目中hook了tt.request方法进行劫持,但是发现使用axios发出的请求无法被我hook的tt.request劫持到。但是我看源码其实原理也是用tt.request去发请求的,所以想请问一下为什么? 代码如下 `export const RequestWithPerformanceReport = ({ reportClient, }: { reportClient: any; }) => { if (!tt || !tt.request) return;
const originttRequest = tt.request;
tt.request = (options: any) => { console.log("options:", options) originttRequest(options); }; }; `
No response
npm
The text was updated successfully, but these errors were encountered:
猜测和执行顺序有关,可以尝试在hook后进行手动适配,看看能不能解决问题。
Sorry, something went wrong.
所以底层应该还是用的tt.request吧(飞书的容器下),另外请问下你说的手动适配是要怎么做呢
可以参考适配方法
import axios from 'axios-miniprogram'; // 需要确保在hook之后执行 axios.defaults.adapter = axios.createAdapter(tt);
可以参考适配方法 import axios from 'axios-miniprogram'; // 需要确保在hook之后执行 axios.defaults.adapter = axios.createAdapter(tt);
感谢,好像确实有用,不过需要这样写才行,否则会报错
No branches or pull requests
描述错误
我在飞书小程序项目中hook了tt.request方法进行劫持,但是发现使用axios发出的请求无法被我hook的tt.request劫持到。但是我看源码其实原理也是用tt.request去发请求的,所以想请问一下为什么?
代码如下
`export const RequestWithPerformanceReport = ({
reportClient,
}: {
reportClient: any;
}) => {
if (!tt || !tt.request) return;
const originttRequest = tt.request;
tt.request = (options: any) => {
console.log("options:", options)
originttRequest(options);
};
};
`
附加上下文
No response
使用过的包管理器
npm
验证
The text was updated successfully, but these errors were encountered: