WebBrokerAPI: Fix: Propagate header-phase SharedContext to body-phase in ProcessByChainKey (hub.go)
Open
@senthuran16 is already working on this.
Since May 14, 2026.
Area/EventGateway
- Dominant language
- Go
- Stars
- 71
- Forks
- 111
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 110
Description
Summary
In event-gateway/gateway-runtime/internal/hub/hub.go, the ProcessByChainKey method builds the body-phase RequestContext via MessageToRequestContext, which creates a fresh SharedContext. As a result, metadata populated during header-phase policy execution is not visible to body-phase policies.
Expected Behavior
Body-phase policies should see metadata set by header-phase policies, consistent with the pattern used in ProcessSubscribe, ProcessInbound, etc.
Suggested Fix
if chain.RequiresRequestBody {
reqCtx := MessageToRequestContext(msg, binding)
reqCtx.SharedContext = reqHeaderCtx.SharedContext
bodyResult, err := h.engine.ExecuteRequestBodyPolicies(ctx, chainKey, reqHeaderCtx.SharedContext, reqCtx)
...
}
References
- PR: https://github.com/wso2/api-platform/pull/1954
- Review comment: https://github.com/wso2/api-platform/pull/1954#discussion_r3239562646
Requested by @senthuran16.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.