Skip to content

fix: hook XMLHttpRequest onloadend for axios compatibility (#674)#705

Open
leno23 wants to merge 1 commit into
MiniProfiler:mainfrom
leno23:fix/axios-onloadend-hook-674
Open

fix: hook XMLHttpRequest onloadend for axios compatibility (#674)#705
leno23 wants to merge 1 commit into
MiniProfiler:mainfrom
leno23:fix/axios-onloadend-hook-674

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 25, 2026

Summary

Fixes #674.

Since axios switched to onloadend instead of onreadystatechange, MiniProfiler's XHR send wrapper no longer intercepted completed axios requests and profiler results were not fetched automatically.

This adds an onloadend hook alongside the existing onreadystatechange and onload wrappers.

Changes

  • MiniProfiler.ts: wrap XMLHttpRequest.onloadend when present, mirroring the existing onload behavior.

Test plan

  • CI passes
  • Manual: page using axios shows updated MiniProfiler results after requests complete
  • Existing jQuery/Angular XHR interception behavior unchanged

…ler#674)

Axios switched from onreadystatechange to onloadend in 2021, so the
MiniProfiler XHR wrapper never saw completed axios requests. Wrap
onloadend the same way as onload to fetch profiler results.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

axios hook not working

1 participant