Skip to content

Conversation

daixijun
Copy link
Contributor

Ⅰ. Describe what this PR did

当请求被拒绝时在 response_code_details 中记录 Consumer 信息

image

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

Copy link

lingma-agents bot commented Jul 22, 2025

feat(key_auth): 记录被拒绝请求时的Consumer信息到响应详情中

变更概述

功能增强 - 错误信息详细化

  • 组件: Key Auth插件的权限验证模块
  • 功能描述: 在请求被拒绝时,将未授权的Consumer名称记录到HTTP响应的错误消息中
  • 实现细节:
    • 新增函数deniedUnauthorizedConsumer接收Consumer名称参数
    • 在验证失败时将具体Consumer名称写入响应消息体
    • 修改checkPlugin方法中的调用逻辑,传递Consumer名称参数
  • 目的: 增强错误日志的可追溯性,帮助运维快速定位问题Consumer

重构 - 函数参数优化

  • 组件: 错误处理函数deniedUnauthorizedConsumer
  • 变更内容:
    • 原函数参数仅包含realm,现新增consumer参数
    • 响应消息格式化为包含具体Consumer名称的字符串
  • 目的: 提升错误信息的上下文完整性
变更文件
文件路径 变更说明
plugins/​wasm-cpp/​extensions/​key_​auth/​plugin.​cc 修改权限验证函数,新增Consumer名称记录到错误响应消息中

💡 小贴士

与 lingma-agents 交流的方式

📜 直接回复评论
直接回复本条评论,lingma-agents 将自动处理您的请求。例如:

  • 在当前代码中添加详细的注释说明。

  • 请详细介绍一下你说的 LRU 改造方案,并使用伪代码加以说明。

📜 在代码行处标记
在文件的特定位置创建评论并 @lingma-agents。例如:

  • @lingma-agents 分析这个方法的性能瓶颈并提供优化建议。

  • @lingma-agents 对这个方法生成优化代码。

📜 在讨论中提问
在任何讨论中 @lingma-agents 来获取帮助。例如:

  • @lingma-agents 请总结上述讨论并提出解决方案。

  • @lingma-agents 请根据讨论内容生成优化代码。

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.02%. Comparing base (ef31e09) to head (a26d213).
Report is 615 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2637       +/-   ##
===========================================
+ Coverage   35.91%   46.02%   +10.11%     
===========================================
  Files          69       81       +12     
  Lines       11576    13020     +1444     
===========================================
+ Hits         4157     5993     +1836     
+ Misses       7104     6681      -423     
- Partials      315      346       +31     

see 78 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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