conflicting req/res scoped variable names
- Dominant language
- JavaScript
- Stars
- 8.2k
- Forks
- 565
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 12
Description
I read that you guys are thinking of a version 2.0 for morgan on one of the other issues..
I didn't see a 2.0 branch so I wasn't sure what your plans are, but I was wondering if you would be implementing the ES6 Symbol technique as to not conflict with any other express middleware that could be trying to store _startTime and such on req/res.
So some something like
```js
const START_TIME = Symbol("startTime");
const START_AT = Symbol("startAt");
const REMOTE_ADDRESS = Symbol("remoteAddress");
....
function recordStartTime() {
this[START_AT] = process.hrtime()
this[START_TIME] = new Date()
}
...
// And expose the Symbols incase other modules may want to hook into morgan
module.exports.START_TIME = START_TIME;
module.exports.START_AT = START_TIME;
module.exports.REMOTE_ADDRESS = REMOTE_ADDRESS;
```
- Colin
Contributor guide
Assessment
This issue has not been assessed yet.