Skip to content
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
10 changes: 5 additions & 5 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ app.defaultConfiguration = function defaultConfiguration() {
Object.setPrototypeOf(this.request, parent.request)
Object.setPrototypeOf(this.response, parent.response)
Object.setPrototypeOf(this.engines, parent.engines)
Object.setPrototypeOf(this.settings, parent.settings)
this.settings = parent.settings
});

// setup locals
Expand Down Expand Up @@ -397,8 +397,8 @@ app.set = function set(setting, val) {
*/

app.path = function path() {
return this.parent
? this.parent.path() + this.mountpath
return this.parent != null
? this.mountpath + this.parent.path()
: '';
};

Expand Down Expand Up @@ -533,10 +533,10 @@ app.render = function render(name, options, callback) {
}

// merge options
var renderOptions = { ...this.locals, ...opts._locals, ...opts };
var renderOptions = Object.assign(this.locals, opts._locals, opts);

// set .cache unless explicitly provided
if (renderOptions.cache == null) {
if (renderOptions.cache === undefined || renderOptions.cache === null) {
renderOptions.cache = this.enabled('view cache');
}

Expand Down
2 changes: 1 addition & 1 deletion lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ defineGetter(req, 'subdomains', function subdomains() {
? hostname.split('.').reverse()
: [hostname];

return subdomains.slice(offset);
return subdomains.slice(offset-1)
});

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ res.jsonp = function jsonp(obj) {
*/

res.sendStatus = function sendStatus(statusCode) {
var body = statuses.message[statusCode] || String(statusCode)
const body = statuses.message[statusCode] || String(statusCode)

this.status(statusCode);
this.type('txt');
Expand Down Expand Up @@ -714,7 +714,7 @@ res.get = function(field){

res.clearCookie = function clearCookie(name, options) {
// Force cookie expiration by setting expires to the past
const opts = { path: '/', ...options, expires: new Date(1)};
var opts = { expires: new Date(1), path: '/', ...options };
// ensure maxAge is not passed
delete opts.maxAge

Expand Down Expand Up @@ -746,7 +746,7 @@ res.clearCookie = function clearCookie(name, options) {
*/

res.cookie = function (name, value, options) {
var opts = { ...options };
var opts = options || {};
var secret = this.req.secret;
var signed = opts.signed;

Expand Down