incubator-seata icon indicating copy to clipboard operation
incubator-seata copied to clipboard

Optimize: add the request and response objects in HTTP thread context

Open lokidundun opened this issue 3 weeks ago • 1 comments

Ⅰ. Describe what this PR did

Optimize: add the request and response objects in HTTP thread context to enable Spring's aspect functionality

  • Add a private response field and a getResponse() method.
  • Introduce a ThreadLocal<HttpFilterContext<?>> to bind the context to the current thread, plus static methods getCurrentContext() and clearCurrentContext().
  • Add a finally block clearCurrentContext(),

Ⅱ. Does this pull request fix one issue?

fixed #7817

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

lokidundun avatar Dec 01 '25 04:12 lokidundun

Codecov Report

:x: Patch coverage is 83.33333% with 9 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 71.08%. Comparing base (c13207c) to head (223bd47).

Files with missing lines Patch % Lines
...seata/core/rpc/netty/http/HttpDispatchHandler.java 79.54% 8 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff            @@
##                2.x    #7822   +/-   ##
=========================================
  Coverage     71.07%   71.08%           
  Complexity      797      797           
=========================================
  Files          1294     1294           
  Lines         49528    49551   +23     
  Branches       5873     5872    -1     
=========================================
+ Hits          35202    35223   +21     
- Misses        11418    11421    +3     
+ Partials       2908     2907    -1     
Files with missing lines Coverage Δ
.../core/rpc/netty/http/filter/HttpFilterContext.java 87.50% <100.00%> (+8.92%) :arrow_up:
...seata/core/rpc/netty/http/HttpDispatchHandler.java 76.34% <79.54%> (+0.09%) :arrow_up:

... and 9 files with indirect coverage changes

Impacted file tree graph

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

codecov[bot] avatar Dec 01 '25 05:12 codecov[bot]