Skip to content

Fix Invoke mediator to handle empty transport headers during connector operation - #2576

Merged
arunans23 merged 1 commit into
wso2:masterfrom
arunans23:invoke-headers
Jul 9, 2026
Merged

Fix Invoke mediator to handle empty transport headers during connector operation#2576
arunans23 merged 1 commit into
wso2:masterfrom
arunans23:invoke-headers

Conversation

@arunans23

Copy link
Copy Markdown
Member

$subject

@arunans23
arunans23 requested a review from chanikag as a code owner July 8, 2026 12:22
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0360e3a2-e205-4753-8aca-850214111c99

📥 Commits

Reviewing files that changed from the base of the PR and between b9784a1 and b2f4dbd.

📒 Files selected for processing (1)
  • modules/core/src/main/java/org/apache/synapse/mediators/template/InvokeMediator.java

📝 Walkthrough

Updated InvokeMediator.prepareForMediation(...) to handle missing transport headers more gracefully during connector operations. When headers are absent, it now initializes an empty header map instead of assuming one is present, preventing the previous failure path while preserving the existing cloning behavior when headers are available.

Walkthrough

The change modifies InvokeMediator.prepareForMediation to guard against a null headers property when constructing the transportHeadersMap. Instead of unconditionally casting and cloning the headers property into a TreeMap, the code now checks for null and creates an empty TreeMap in that case, otherwise cloning the existing headers into a TreeMap.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is only a placeholder and does not include the required template sections or implementation details. Replace the placeholder with the full template content, including Purpose, Goals, Approach, User stories, Release note, Documentation, tests, and security checks.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: handling empty transport headers in the Invoke mediator.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@arunans23
arunans23 merged commit db55d60 into wso2:master Jul 9, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants