Socket
Socket
Sign inDemoInstall

express

Package Overview
Dependencies
18
Maintainers
0
Versions
276
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.4.0 to 2.4.1

12

History.md
2.4.1 / 2011-07-06
==================
* Added `res.json()` JSONP support. Closes #737
* Added _extending-templates_ example. Closes #730
* Added "strict routing" setting for trailing slashes
* Added support for multiple envs in `app.configure()` calls. Closes #735
* Changed: `res.send()` using `res.json()`
* Changed: when cookie `path === null` don't default it
* Changed; default cookie path to "home" setting. Closes #731
* Removed _pids/logs_ creation from express(1)
2.4.0 / 2011-06-28

@@ -3,0 +15,0 @@ ==================

2

lib/express.js

@@ -31,3 +31,3 @@

exports.version = '2.4.0';
exports.version = '2.4.1';

@@ -34,0 +34,0 @@ /**

@@ -474,5 +474,22 @@

/**
* Configure callback for the given `env`.
* Configure callback for zero or more envs,
* when no env is specified that callback will
* be invoked for all environments. Any combination
* can be used multiple times, in any order desired.
*
* @param {String} env
* Examples:
*
* app.configure(function(){
* // executed for all envs
* });
*
* app.configure('stage', function(){
* // executed staging env
* });
*
* app.configure('stage', 'production', function(){
* // executed for stage and production
* });
*
* @param {String} env...
* @param {Function} fn

@@ -484,4 +501,7 @@ * @return {Server} for chaining

app.configure = function(env, fn){
if ('function' == typeof env) fn = env, env = 'all';
if ('all' == env || env == this.settings.env) fn.call(this);
var envs = 'all'
, args = toArray(arguments);
fn = args.pop();
if (args.length) envs = args;
if ('all' == envs || ~envs.indexOf(this.settings.env)) fn.call(this);
return this;

@@ -488,0 +508,0 @@ };

@@ -78,12 +78,3 @@

} else {
if (!this.header('Content-Type')) {
this.charset = this.charset || 'utf-8';
this.contentType('.json');
}
body = JSON.stringify(body);
if (this.req.query.callback && this.app.set('jsonp callback')) {
this.charset = this.charset || 'utf-8';
this.header('Content-Type', 'text/javascript');
body = this.req.query.callback.replace(/[^\w$.]/g, '') + '(' + body + ');';
}
return this.json(body, headers, status);
}

@@ -139,5 +130,15 @@ break;

res.json = function(obj, headers, status){
var body = JSON.stringify(obj)
, callback = this.req.query.callback
, jsonp = this.app.enabled('jsonp callback');
this.charset = this.charset || 'utf-8';
this.header('Content-Type', 'application/json');
return this.send(JSON.stringify(obj), headers, status);
if (callback && jsonp) {
this.header('Content-Type', 'text/javascript');
body = callback + '(' + body + ');';
}
return this.send(body, headers, status);
};

@@ -308,2 +309,3 @@

* - `maxAge` max-age in milliseconds, converted to `expires`
* - `path` defaults to the "home" setting which is typically "/"
*

@@ -327,2 +329,3 @@ * Examples:

if ('maxAge' in options) options.expires = new Date(Date.now() + options.maxAge);
if (undefined === options.path) options.path = this.app.set('home');
var cookie = utils.serializeCookie(name, val, options);

@@ -329,0 +332,0 @@ this.header('Set-Cookie', cookie);

@@ -376,2 +376,3 @@

sensitive: app.enabled('case sensitive routes')
, strict: app.enabled('strict routing')
, middleware: middleware

@@ -378,0 +379,0 @@ });

@@ -20,3 +20,4 @@

*
* - `sensitive` enable case-sensitive routes
* - `sensitive` enable case-sensitive routes
* - `strict` enable strict matching for trailing slashes
* - `middleware` array of middleware

@@ -36,4 +37,7 @@ *

this.method = method;
this.regexp = normalize(path, this.keys = [], options.sensitive);
this.middleware = options.middleware;
this.regexp = normalize(path
, this.keys = []
, options.sensitive
, options.strict);
}

@@ -65,2 +69,3 @@

* @param {Boolean} sensitive
* @param {Boolean} strict
* @return {RegExp}

@@ -70,6 +75,6 @@ * @api private

function normalize(path, keys, sensitive) {
if (path instanceof RegExp) return path;
function normalize(path, keys, sensitive, strict) {
if (path instanceof RegExp) return path;
path = path
.concat('/?')
.concat(strict ? '' : '/?')
.replace(/\/\(/g, '(?:/')

@@ -76,0 +81,0 @@ .replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g, function(_, slash, format, key, capture, optional){

@@ -321,4 +321,3 @@

fn(err);
// unwind to root call to prevent
// several next(err) calls
// unwind to root call to prevent multiple callbacks
} else if (sub) {

@@ -325,0 +324,0 @@ throw err;

{
"name": "express",
"description": "Sinatra inspired web development framework",
"version": "2.4.0",
"version": "2.4.1",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -13,3 +13,3 @@ "contributors": [

"dependencies": {
"connect": ">= 1.5.1 < 2.0.0",
"connect": ">= 1.5.2 < 2.0.0",
"mime": ">= 0.0.1",

@@ -16,0 +16,0 @@ "qs": ">= 0.0.6"

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc