Deprecate req.path and replace with req.pathname
- Dominant language
- JavaScript
- Stars
- 69.5k
- Forks
- 25k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 9
Description
So currently in Express 4 (and lower) there is `req.path`, which is added by Express. This property will return the _pathname_ of the given request. There has surfaced two issues here now:
(1) The new Node.js HTTP/2 compatibility API introduces a new (currently undocumented) `req.path` property that is an alias for the `:path` puesdo-header (`req.headers[':path']`) and so the meaning of `req.path` in Express vs in the HTTP/2 compatibility layer differ (Express = pathname of `req.url` and HTTP/2 compatibility API = `:path` header, basically what `req.url` is in HTTP/1).
(2) The property itself is sort-of misnamed, similar to the `req.host` header that was deprecated already and replaced with `req.hostname` (to come back in Express 5.0 with the current meaning in `req.host`).
I am proposing that `req.path` is deprecated in Express 4 with a new `req.pathname` introduced in Express 4 and beyond to hold the existing `req.path` behavior.
Contributor guide
Assessment
This issue has not been assessed yet.