Skip to content
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

npm 包esdk-obs-browserjs 内,axios,没有create,导致项目和esdk 包 用了同一个axios 实例 #25

Open
lei-mu opened this issue Jun 23, 2022 · 3 comments

Comments

@lei-mu
Copy link

lei-mu commented Jun 23, 2022

项目内使用了axios 实例,并且没有create
项目内:

import axios from 'axios'
axios.defaults.headers.Authorization = 'fdsafsda'

npm 包esdk-obs-browserjs 内

import axios from 'axios'
axios.request()

表现:

包内request headers 会携带 Authorization 导致请求失败。

期望:
包内axios 应使用 create 重新new 一个实例,避免和项目内实例互相污染。

import axios from 'axios'
const http = axios.create()
http.request()
@webchenjie
Copy link

你自己项目也可以 create 一个吧

@lei-mu
Copy link
Author

lei-mu commented Jun 29, 2022

是的,我现在就是这样解决的。

对于一个sdk来说,这就是一个bug,对我的项目有侵入性了。

@noaccident
Copy link
Collaborator

这个确实是个问题,下个版本我们会在sdk里面创建一个axios实例,不会影响上层服务。非常感谢您的反馈。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants