-
-
Notifications
You must be signed in to change notification settings - Fork 5
fix: 兼容安卓钉钉返回header格式 #53
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughA compatibility fix added to the request handler to detect when result.header is an array (produced by DingTalk Android) and merge it into a single object before constructing AxiosHeaders, while preserving the existing response handling flow. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/methods/request.ts (1)
23-29: DingTalk header normalization logic is sound; consider minor typing/robustness tweaksThe new handling for array-shaped headers works and keeps the existing flow intact. To make it a bit more robust and TS-friendly, you could (optionally) add an explicit type for
dingHeaderand guard against non-object entries in the array:- // 兼容钉钉安卓返回的header格式 - if (Array.isArray(result.header)) { - const dingHeader = {} - result.header.forEach(h => Object.assign(dingHeader, h)) - result.header = dingHeader - } + // 兼容钉钉安卓返回的 header 格式 + if (Array.isArray(result.header)) { + const dingHeader: Record<string, any> = {} + result.header.forEach((h) => { + if (h && typeof h === 'object') + Object.assign(dingHeader, h) + }) + result.header = dingHeader + }
|
@ModyQyW 是否应该在库层面抹平差异呀? |
|
等官方得何年了 |


钉钉安卓返回长这样。。。。
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.