konlue opened a new pull request, #7798:
URL: https://github.com/apache/shenyu/pull/7798

   Fixes #7796.
   
   ## Summary
   
   When the context-path plugin has not run, both the `REWRITE_CONTEXT_PATH` 
and fallback `CONTEXT_PATH` exchange attributes are null, so `RewritePlugin` 
builds its metadata lookup key as the literal string `"null" + rewriteUri`. A 
rewrite rule with `rewriteMetaData=true` therefore never finds metadata cached 
under the plain rewritten path.
   
   ## Modifications
   
   - Default the absent context-path prefix to an empty string before 
concatenating with the rewritten URI, so the lookup key matches the path 
semantics used by the rewrite and context-path plugins.
   - Add a regression test: no context-path attributes, `rewriteMetaData=true`, 
metadata cached under the bare rewritten path — the resolved rpc type must come 
from the metadata.
   
   ## Verifying this change
   
   - [x] New `RewritePluginTest#shouldLookUpMetaDataWithoutContextPath`: fails 
on the current code (lookup misses, rpc type falls back to http) and passes 
with the fix.
   - [x] Targeted tests pass:
   
     ```bash
     ./mvnw -B -ntp -pl shenyu-plugin/shenyu-plugin-rewrite test 
-Dtest=RewritePluginTest
     ```
     8/8 green.
   
   - [x] Checkstyle passes:
   
     ```bash
     ./mvnw -B -ntp -pl shenyu-plugin/shenyu-plugin-rewrite checkstyle:check
     ```
     clean.
   
   ## Notes
   
   When a context path IS present the concatenated key is unchanged, so 
existing dubbo/other-rpc metadata lookups behave identically. No cache 
structure changes — only the key construction is made null-safe.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to