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

Add support for request-received middleware #66

Open
niftylettuce opened this issue Jun 13, 2019 · 1 comment
Open

Add support for request-received middleware #66

niftylettuce opened this issue Jun 13, 2019 · 1 comment

Comments

@niftylettuce
Copy link

niftylettuce commented Jun 13, 2019

The request-received middleware at https://github.com/cabinjs/request-received exposes a Symbol.for property, which this package could conditionally consume if interested (as opposed to just generating a new Date().

e.g. https://github.com/pinojs/pino-http/blob/master/logger.js#L63 would change as follows:

-    res[startTime] = res[startTime] || Date.now()
+    res[startTime] = res[startTime] || req[Symbol.for('request-received.startTime')] ? req[Symbol.for('request-received.startTime')].getTime() : Date.now()

Ref: #65

@niftylettuce
Copy link
Author

PR #67 opened

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

1 participant