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

   ## What
   
   `JsonOperator` crashes on `application/json` requests with an empty body: 
the body falls back to `""` and `JsonPath.parse("")` throws 
`IllegalArgumentException: json string can not be null or empty`, failing the 
request.
   
   ## How
   
   - Empty body + no add rules: pass the original exchange through unchanged.
   - Empty body + add rules: treat the body as `{}` and apply the rules.
   - The body rewrite and buffer release now only run on the modify path.
   
   This mirrors the existing empty-form handling in `FormDataOperator`. The 
valueless form parameter issue was already fixed in #7902; this PR also adds a 
`flag&name=x` test case for it.
   
   ## Tests
   
   - `JsonOperatorTest`: missing body and empty-string body pass through; add 
rules applied to an empty body; the existing case now asserts the rewritten 
body.
   
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true`.
   


-- 
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