Skip to content

changed "req.name" to "req.pathname" #5841

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -2771,7 +2771,7 @@ unreleased
* Added `req.subdomains`
* Added `req.protocol`
* Added `req.secure`
* Added `req.path`
* Added `req.pathname`
* Added `req.ips`
* Added `req.fresh`
* Added `req.stale`
Expand Down Expand Up @@ -2872,7 +2872,7 @@ unreleased

* Added mkdirp to express(1). Closes #795
* Added simple _json-config_ example
* Added shorthand for the parsed request's pathname via `req.path`
* Added shorthand for the parsed request's pathname via `req.pathname`
* Changed connect dep to 1.7.x to fix npm issue...
* Fixed `res.redirect()` __HEAD__ support. [reported by xerox]
* Fixed `req.flash()`, only escape args
Expand Down
2 changes: 1 addition & 1 deletion examples/static-files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ app.use(logger('dev'));
// express on its own has no notion
// of a "file". The express.static()
// middleware checks for a file matching
// the `req.path` within the directory
// the `req.pathname` within the directory
// that you pass it. In this case "GET /js/app.js"
// will look for "./public/js/app.js".

Expand Down
4 changes: 2 additions & 2 deletions test/req.path.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ var express = require('../')
, request = require('supertest');

describe('req', function(){
describe('.path', function(){
describe('.pathname', function(){
it('should return the parsed pathname', function(done){
var app = express();

app.use(function(req, res){
res.end(req.path);
res.end(req.pathname);
});

request(app)
Expand Down
2 changes: 1 addition & 1 deletion test/req.signedCookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('req', function(){
app.use(cookieParser('secret'));

app.use(function(req, res){
if (req.path === '/set') {
if (req.pathname === '/set') {
res.cookie('obj', { foo: 'bar' }, { signed: true });
res.end();
} else {
Expand Down