Skip to content

Deprecate req.path and replace with req.pathname #3407

Open
@dougwilson

Description

@dougwilson

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions