Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

fix: workaround for express.js 'host' deprecation message #413

Merged
merged 1 commit into from
Jan 10, 2018

Conversation

kamilogorek
Copy link
Contributor

Ref: #96 (comment)
Ref: #412

Copy link

@AmazingTurtle AmazingTurtle left a comment

Choose a reason for hiding this comment

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

This will fix the deprecation warning by express in first place by replacing 'host' by 'hostname' in nonEnumerables. However checking for 'hostname' using hasOwnProperty in the second place does not fix anything at all. Koajs (just to mention, because you made changes for also keeping that one intact) has both hostname and host aswell. Therefore your fix won't apply here.

* REF: https://github.com/getsentry/raven-node/issues/96#issuecomment-354748884
**/
if (!request.hasOwnProperty('hostname')) {
sources.forEach(function(source) {

Choose a reason for hiding this comment

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

Iteration is pointless

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not because we want to keep correct order or eventual overrides – https://github.com/getsentry/raven-node/blob/master/lib/client.js#L229-L247

@kamilogorek
Copy link
Contributor Author

kamilogorek commented Jan 3, 2018

@AmazingTurtle in Koa host is just hostname + port. We are mostly concerned about the hostname itself, therefore we use similar check here https://github.com/getsentry/raven-node/blob/master/lib/parsers.js#L71-L75
Therefore as long as we have at least one of these, we're good.

@kamilogorek kamilogorek merged commit a0e7da9 into master Jan 10, 2018
@kamilogorek kamilogorek deleted the host-deprecation-msg branch January 10, 2018 10:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants