Skip to content
New issue

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

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

Already on GitHub? # to your account

guard against req.url being falsy #2

Open
wants to merge 1 commit into
base: rektide/restify-url-fix
Choose a base branch
from

Conversation

rektide
Copy link
Owner

@rektide rektide commented Feb 23, 2022

it's tempting to simply stop looking at req.url.path altogether, since that was introduced for hapi 17 in pinojs@83d58a7#diff-2c4782cb20f7f0d7ca90c7bc04939f4420c4bdb42fdce618984da393ba9202f7R60 .

but since pinojs#29 we look at req.path first (which has been around since hapi v1.0.0), which is safer in hapi, so hapi doesn't care about req.url.path anymore. this pr presents the 'what if' we drop req.url.path.

perhaps someone else does depend on req.url.path. but probably no one does. req.url is in most cases straight from node's message.url, so it's quite traditional to find it, as a string, safe to use. this pr would simplify the pino-std-serializer codebase, at some small risk to strange users (but not hapi ones).

it's tempting to simply stop looking at req.url.path altogether, since that was introduced for hapi 17 in pinojs@83d58a7#diff-2c4782cb20f7f0d7ca90c7bc04939f4420c4bdb42fdce618984da393ba9202f7R60 .

but since pinojs#29 we look at req.path first, which is safer in hapi, so hapi doesn't care about req.url.path anymore.

but perhaps someone else does depend on req.url.path . so for now, continuing to look at req.url.path , which means a bit more guarding in the req serializer.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant