Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutgoingMessage.prototype._headers is deprecated #28

Closed
Valkyrihane opened this issue Apr 24, 2021 · 2 comments
Closed

OutgoingMessage.prototype._headers is deprecated #28

Valkyrihane opened this issue Apr 24, 2021 · 2 comments

Comments

@Valkyrihane
Copy link

Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch timed-out@4.0.1 for the project I'm working on.

._headers access function has been deprecated since Node v12. v14 being the current LTS, while v16 is active, it would be nice to upgrade the used method in order to avoid deprecation warnings/errors on builds (in my case building my gatsby website)

A related issue (#25) was opened then closed by its author without any real solution (I'm not using npm-name)

Here is the diff that solved my problem:

diff --git a/node_modules/timed-out/index.js b/node_modules/timed-out/index.js
index 94007a4..fc40d52 100644
--- a/node_modules/timed-out/index.js
+++ b/node_modules/timed-out/index.js
@@ -6,7 +6,7 @@ module.exports = function (req, time) {
 	}
 
 	var delays = isNaN(time) ? time : {socket: time, connect: time};
-	var host = req._headers ? (' to ' + req._headers.host) : '';
+	var host = req.getHeaders() ? (' to ' + req.getHeaders().host) : '';
 
 	if (delays.connect !== undefined) {
 		req.timeoutTimer = setTimeout(function timeoutHandler() {

This issue body was partially generated by patch-package.

@sindresorhus
Copy link
Owner

This has already been fixed some versions ago. Please do a bit of effort before opening an issue.

@Valkyrihane
Copy link
Author

This one's on me, an old version of timed-out was used in my dependency tree, and I checked the wrong commit on github. Sorry for the unneeded issue !

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

No branches or pull requests

2 participants