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

refactor: storage 抽为同构方案 & httpClient 重构支持流式 & configManager 抽离 #232

Merged
merged 4 commits into from
Jan 3, 2024

Conversation

moshangqi
Copy link
Collaborator

@moshangqi moshangqi commented Dec 26, 2023

🤔 这个变动的性质是?

  • 新特性
  • 问题修复
  • 优化增强
  • 重构

🔗 相关 Issue

@xudafeng xudafeng removed the request for review from ColaDaddyz January 2, 2024 07:08
...headers,
..._config.headers,
},
..._config,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 _config.headers 不会覆盖 headers 么?,那上面的 ...headers 就无效了吧

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

会覆盖,下个 pr 优化。这块已经提了

Accept: 'application/json',
...config.headers,
};
config.body = JSON.stringify(_config.data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 data 为会为空么

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有可能,看使用方,不过为空好像也没有问题

const readableStreamConfig = {
start: (controller: ReadableStreamDefaultController) => {
const read = () => {
reader
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我记得 for...of 操作可读性会更好

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块我看看后面把他改成 for of

});
}

if (e.code === 20 && e.name === 'AbortError') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code 为啥会是 20,好奇怪的定义

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这块 code 试 debug 对时候测出来的, AbortError 的 code 是 20 ,估计是内部设置的吧。当时为了保险,加了一个 code 和 name 判断 AbortError

src/core/webProxy/base.ts Show resolved Hide resolved
@moshangqi moshangqi merged commit ffa2fb4 into main Jan 3, 2024
1 check passed
@moshangqi moshangqi deleted the refactor/storage-http branch January 3, 2024 09:43
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

Successfully merging this pull request may close these issues.

2 participants