This recipe ensures HTTP classes likeDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nodejs/userland-migrations/llms.txt
Use this file to discover all available pages before exploring further.
OutgoingMessage, ServerResponse, IncomingMessage, and ClientRequest are properly instantiated with the new keyword.
Deprecation
Node.js deprecated calling HTTP constructors without thenew keyword. Classes must be instantiated with new.
See DEP0195 for more details.
Usage
Run this codemod with:Before/After
What It Does
- Adds
newkeyword beforeOutgoingMessage(),ServerResponse(),IncomingMessage(), andClientRequest()calls - Works with both direct imports and namespace imports (e.g.,
http.OutgoingMessage()) - Handles CommonJS and ESM module patterns
Affected Classes
The following HTTP classes are updated:OutgoingMessageServerResponseIncomingMessageClientRequest