fix: 钉钉通知解析响应 errcode,失败时输出真实原因 - #29
Open
Ion-nsx wants to merge 3 commits into
Open
Conversation
钉钉机器人接口即使拒绝消息(关键词不匹配、加签错误、access_token 无效、IP 白名单等)也返回 HTTP 200,原实现仅检查 resp.ok 会把失败 误判为发送成功,导致用户收不到通知却看到日志显示成功。 改为解析响应体 errcode: - errcode == 0 视为成功 - 否则打印钉钉返回的 errmsg 并返回 false,统计为发送失败 README 补充钉钉机器人安全设置(自定义关键词 / 加签 / IP 白名单) 的注意事项,避免新用户踩同样的坑。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
钉钉机器人接口即使拒绝消息(关键词不匹配、加签错误、access_token
无效、IP 白名单等)也返回 HTTP 200,原实现仅检查 resp.ok 会把失败
误判为发送成功,导致用户收不到通知却看到日志显示成功。
改为解析响应体 errcode: