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

fix: Bypass the response body processing in ai-proxy if it is returned internally #1149

Merged
merged 3 commits into from
Jul 24, 2024

Conversation

CH3CHO
Copy link
Collaborator

@CH3CHO CH3CHO commented Jul 24, 2024

Ⅰ. Describe what this PR did

Bypass the response body processing in ai-proxy if it is returned internally.

Ⅱ. Does this pull request fix one issue?

fixes #1145

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-commenter
Copy link

codecov-commenter commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.11%. Comparing base (ef31e09) to head (770bfbb).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1149      +/-   ##
==========================================
+ Coverage   35.91%   36.11%   +0.20%     
==========================================
  Files          69       69              
  Lines       11576     9464    -2112     
==========================================
- Hits         4157     3418     -739     
+ Misses       7104     5730    -1374     
- Partials      315      316       +1     

see 67 files with indirect coverage changes

@@ -111,6 +111,12 @@ func onHttpRequestBody(ctx wrapper.HttpContext, pluginConfig config.PluginConfig
}

func onHttpResponseHeaders(ctx wrapper.HttpContext, pluginConfig config.PluginConfig, log wrapper.Log) types.Action {
if codeDetails, err := proxywasm.GetProperty([]string{"response", "code_details"}); err == nil && string(codeDetails) != "via_upstream" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这段逻辑要不要在wrapper里加个工具函数,其他地方也可能会用到

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

可以

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator

@johnlanni johnlanni left a comment

Choose a reason for hiding this comment

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

LGTM

@johnlanni johnlanni merged commit f6ee4ed into alibaba:main Jul 24, 2024
12 checks passed
@CH3CHO CH3CHO deleted the fix/ai-proxy-bypass-internal-resp branch July 24, 2024 08:19
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.

ai-proxy + request block 断开连接
3 participants