-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(logging): use getRequestPath to more robustly identify debug logs (…
- Loading branch information
1 parent
8eeddad
commit cd14619
Showing
3 changed files
with
22 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import type { Request } from 'express' | ||
import type { IncomingMessage } from 'http' | ||
import type express from 'express' | ||
import { get } from 'lodash' | ||
|
||
export const getRequestPath = (req: IncomingMessage | express.Request) => { | ||
const path = (get(req, 'originalUrl') || get(req, 'url') || '').split( | ||
export const getRequestPath = (req: IncomingMessage | Request) => { | ||
const path = ((get(req, 'originalUrl') || get(req, 'url') || '') as string).split( | ||
'?' | ||
)[0] as string | ||
)[0] | ||
return path?.length ? path : null | ||
} |