Skip to content

Fix: Resolve redundant callbacks and missing payloads in HttpRequest#7475

Open
lavjeetrai wants to merge 1 commit into
sugarlabs:masterfrom
lavjeetrai:httpreq
Open

Fix: Resolve redundant callbacks and missing payloads in HttpRequest#7475
lavjeetrai wants to merge 1 commit into
sugarlabs:masterfrom
lavjeetrai:httpreq

Conversation

@lavjeetrai

Copy link
Copy Markdown
Contributor

Summary
Refactors the legacy HttpRequest constructor to use onload and onerror instead of onreadystatechange. This prevents callbacks from firing multiple times per request and fixes a bug where userCallback was ignored on success.

Eliminates wasteful, redundant executions of loadCallback (which previously fired on ready states 1, 2, 3, and 4) and ensures successful network payloads are actually passed back to the requesting function.

Category

  • Bug Fix

@github-actions github-actions Bot added bug fix Fixes a bug or incorrect behavior size/S Small: 10-49 lines changed area/javascript Changes to JS source files labels Jun 5, 2026
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🧪 Jest Test Results

❌ Some Jest tests failed. Please check the logs and fix the issues before merging.

Coverage: Statements: 48.29% | Branches: 39.89% | Functions: 53% | Lines: 48.69%
Master Coverage: Statements: 48.3% | Branches: 39.91% | Functions: 53.01% | Lines: 48.7%

Note: These failures may be introduced by this PR or may already exist in the master branch.
Tip: Update your branch with the latest master and rerun tests.
If the same failures are present on master, they are likely not introduced by this PR.

Failed Tests:

aidebugger.test.js

@lavjeetrai

Copy link
Copy Markdown
Contributor Author

The aidebugger.test.js failure is an existing issue currently failing on master. I verified this locally—it is completely unrelated to my changes.

@lavjeetrai

Copy link
Copy Markdown
Contributor Author

@Ashutoshx7 can u reveiw this pr when u have time ?

@lavjeetrai

Copy link
Copy Markdown
Contributor Author

@walterbender can u have a loook to these changess when got time ?

@vyagh vyagh requested a review from walterbender June 11, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/javascript Changes to JS source files bug fix Fixes a bug or incorrect behavior size/S Small: 10-49 lines changed

Projects

Development

Successfully merging this pull request may close these issues.

1 participant