Skip to content

http: runtime deprecate instantiating without new - #64853

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
anonrig:http-runtime-dep0195
Aug 1, 2026
Merged

http: runtime deprecate instantiating without new#64853
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
anonrig:http-runtime-dep0195

Conversation

@anonrig

Copy link
Copy Markdown
Member

Description

Promote DEP0195 from Documentation-only to Runtime.

Calling node:http constructors without new now emits a DeprecationWarning (DEP0195) via deprecateInstantiation, matching the earlier runtime path for zlib (DEP0184) and repl (DEP0185).

Covered constructors

ClassBeforeAfter
AgentSilent auto-newWorks + DEP0195
ServerSilent auto-newWorks + DEP0195
OutgoingMessageBroken / undefined thisWorks + DEP0195
IncomingMessageThrewWorks + DEP0195
ServerResponseThrewWorks + DEP0195
ClientRequestThrewWorks + DEP0195

createServer() / request() / get() paths are unchanged (they already use new).

Tests

  • Add test/parallel/test-http-dep0195.js
  • Update in-tree call sites that used http.Server(...) / http.Agent(...) without new

Migration

npx codemod@latest @nodejs/http-classes-with-new

Test plan

  • parallel/test-http-dep0195
  • Batch of affected http/cluster tests (32) — all pass
  • make lint-js
  • core-validate-commit

Refs: #58518

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net
  • @nodejs/userland-migrations

@anonrig
anonrigforce-pushed the http-runtime-dep0195 branch from e88a573 to 08c1731CompareJuly 30, 2026 21:23
@nodejs-github-botnodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jul 30, 2026
Promote DEP0195 from documentation-only to a runtime deprecation.
Calling node:http constructors without `new` now emits DEP0195 via
deprecateInstantiation. This covers Agent, Server, OutgoingMessage,
IncomingMessage, ServerResponse, and ClientRequest.
Update in-tree tests that called Server/Agent without `new` to use
the keyword, and add a dedicated DEP0195 coverage test.
Refs: nodejs#58518
Assisted-by: Grok
Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
@anonrig
anonrigforce-pushed the http-runtime-dep0195 branch from 08c1731 to e42b138CompareJuly 30, 2026 21:41
@anonriganonrig added semver-major PRs that contain breaking changes and should be released in the next major version. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jul 30, 2026
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 30, 2026
@nodejs-github-bot

This comment was marked as outdated.

@codecov

codecovBot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.15%. Comparing base (eea8d72) to head (e42b138).
⚠️ Report is 462 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #64853 +/- ##
==========================================
- Coverage 91.98% 90.15% -1.83% 
==========================================
Files 381 746 +365 Lines 167876 242788 +74912 Branches 25662 45776 +20114 ==========================================
+ Hits 154414 218881 +64467 - Misses 13175 15404 +2229 - Partials 287 8503 +8216 
Files with missing linesCoverage Δ
lib/_http_agent.js96.13% <100.00%> (-0.55%)⬇️
lib/_http_client.js97.64% <100.00%> (+0.17%)⬆️
lib/_http_incoming.js97.94% <100.00%> (-1.45%)⬇️
lib/_http_outgoing.js97.63% <100.00%> (+1.93%)⬆️
lib/_http_server.js96.48% <100.00%> (-0.03%)⬇️

... and 567 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@AugustinMauroyAugustinMauroy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT !

@Renegade334Renegade334 added the deprecations Issues and PRs related to deprecations. label Jul 31, 2026
@anonrig

Copy link
Copy Markdown
MemberAuthor

cc @nodejs/tsc this is a semver-major. needs more reviews

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollinamcollina added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 31, 2026
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 1, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 25c0c8e into nodejs:mainAug 1, 2026
82 of 83 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 25c0c8e

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.deprecationsIssues and PRs related to deprecations.lib / srcIssues and PRs related to general changes in the lib or src directory.needs-ciPRs that need a full CI run.semver-majorPRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

11 participants

@anonrig@nodejs-github-bot@mcollina@panva@pimterry@efekrskl@avivkeller@gurgunday@AugustinMauroy@bjohansebas@Renegade334