Aias00 opened a new issue, #7735: URL: https://github.com/apache/shenyu/issues/7735
### Current behavior `FormDataOperator.apply()` returns directly to the chain when parsed form data is empty. It does so before executing `operation()`, which applies `addParameterKeys`. Thus a rule that should inject a parameter works for a one-field form but does nothing for an empty form. ### Location / trigger [FormDataOperator.java:64–69 and 103–109](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-plugin/shenyu-plugin-param-mapping/src/main/java/org/apache/shenyu/plugin/param/mapping/strategy/FormDataOperator.java#L64). Configure an add mapping with path `$`, key `injected`, value `yes`; send a matching request with `Content-Type: application/x-www-form-urlencoded` and an empty body. ### Reproduction / evidence A Java probe compiled the current FormDataOperator/Operator sources and ran `apply()` with mock WebFlux exchanges, capturing the request body delivered to the next chain step: ```text FORM_INPUT= OUTPUT= FORM_INPUT=a=1 OUTPUT=a=1&injected=yes ``` The same rule injects the field only when an unrelated original field exists. An independent reviewer confirmed that the empty guard bypasses the configured addition logic. This does not claim anything about whether an empty JSON body is valid JSON. ### Expected behavior / impact Form additions should be able to create configured fields even when no original fields were supplied. Backends relying on injected defaults currently receive an empty request. Remove/delete-only rules may legitimately remain no-ops for an empty form; additions should still run. ### Suggested fix Apply mapping operations to an empty form representation rather than returning before additions, then serialize the resulting map through the existing form writer. Preserve the no-op path where no operation produces any field. ### Related existing work #4695 concerns nested/dotted form names. #1927 reports a general custom-form-addition handoff symptom without this empty-input early-return trigger; this report isolates that branch with a passing non-empty control. The earlier suspected raw parameter-name encoding defect was rejected because Spring's actual form writer encodes names correctly. ### Reviewed revision Apache ShenYu 2.7.2-SNAPSHOT, `master@66d7d954ca37d651a5ad916f988a8081157a7ab4`. Priority P2 / Medium. Unit-test and CI issue categories excluded. -- 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]
