wso2 / wso2/reference-implementation-openhie
Propagate build failures instead of silently continuing.
Nobody has claimed this yet.
- Dominant language
- Ballerina
- Stars
- 1
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Propagate auth-header build failures instead of silently continuing.
If buildCRAuthHeader returns an error, the request currently proceeds without Authorization. This should fail fast to keep outbound auth behavior consistent.
Suggested fix
- string|error crAuthHeader = buildCRAuthHeader(req);
- if crAuthHeader is string {
- outboundFHIRReq.setHeader("Authorization", crAuthHeader);
- }
+ string crAuthHeader = check buildCRAuthHeader(req);
+ outboundFHIRReq.setHeader("Authorization", crAuthHeader);
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
string crAuthHeader = check buildCRAuthHeader(req);
outboundFHIRReq.setHeader("Authorization", crAuthHeader);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@iol/iol-core/router.bal` around lines 152 - 155, The code silently ignores
errors from buildCRAuthHeader causing outbound requests to be sent without
Authorization; change the logic to fail fast: after calling
buildCRAuthHeader(check crAuthHeader), if it is an error propagate it (return or
throw) from the current function instead of continuing, otherwise set the header
with outboundFHIRReq.setHeader(crAuthHeader); reference the symbol
buildCRAuthHeader and the variable crAuthHeader to locate the change and ensure
the function's signature/caller supports propagating the error (add a returning
error path if needed).
Originally posted by @coderabbitai[bot] in https://github.com/wso2/reference-implementation-openhie/pull/7#discussion_r3201537432
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.
Research direction
Open iol/iol-core/router.bal around lines 152–155 and inspect buildCRAuthHeader, crAuthHeader, and the enclosing function. Trace its callers to confirm how an error can be propagated, then verify that failed header construction stops the request and successful construction sets Authorization. Run the repository's relevant tests or validation commands, since no specific test file is named.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, authentication, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 64/100