bhuvan-somisetty opened a new pull request, #14043:
URL: https://github.com/apache/apisix/pull/14043

   ### Description
   
   In `apisix/patch.lua`, monkey-patched `ngx.req.set_body_data` only cleared 
`_request_body_table` and `_request_body_type`, leaving `api_ctx.req_post_args` 
populated with stale cached form arguments from the pre-rewrite body. In 
addition, invalidation of `post_arg.*` variables in `var._cache` was nested 
inside `if api_ctx and api_ctx._request_body_table then`, which skipped 
variable cache invalidation whenever `_request_body_table` was not yet 
populated or was nil.
   
   This PR updates `ngx.req.set_body_data`:
   1. Always clears `api_ctx.req_post_args` so that subsequent calls to 
`core.request.get_post_args(ctx)` re-parse arguments from the updated body.
   2. Unconditionally clears `post_arg.*` variables in `api_ctx.var._cache` 
whenever `ngx.req.set_body_data` is invoked.
   3. Adds comprehensive test coverage in `t/core/request.t` (TEST 20).
   
   #### Which issue(s) this PR fixes:
   
   Fixes #14042
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   


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