nodejs / nodejs/userland-migrations
XMLHttpRequest to fetch
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 85
- Forks
- 55
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 9
Description
This isn't really node specific, but XMLHttpRequest has long been all-but-replaced by fetch, and it would be nice to add a migration to allow these legacy codebases to run in modern environments, including Node.js
Before:
const req = new XMLHttpRequest();
req.addEventListener("load", () => console.log(this.responseText));
req.open("GET", "http://www.example.org/example.txt");
req.send();
After:
const req = await fetch("http://example.org");
console.log(req.text());
Contributor guide
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
The issue names no files or tests; start by locating the migration entry point for XMLHttpRequest and reviewing how existing API migrations are tested. Use the supplied before-and-after examples to define the expected transformation, then add coverage showing legacy XMLHttpRequest code can run in modern Node.js with fetch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100