0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Update express and body-parser dependencies.

No Issue
- Upgrade to versions of these packages that use qs >= 1.0.0.
This commit is contained in:
Jason Williams 2014-08-09 13:48:58 +00:00
parent 17352c0d56
commit 8fb3cddcf6
6 changed files with 11 additions and 11 deletions

View file

@ -265,7 +265,7 @@ http = function (apiMethod) {
// #### Error // #### Error
var httpErrors = formatHttpErrors(error); var httpErrors = formatHttpErrors(error);
// Send a properly formatted HTTP response containing the errors // Send a properly formatted HTTP response containing the errors
res.json(httpErrors.statusCode, {errors: httpErrors.errors}); res.status(httpErrors.statusCode).json({errors: httpErrors.errors});
}); });
}; };
}; };

View file

@ -230,14 +230,14 @@ errors = {
stack: stack stack: stack
}, function (templateErr, html) { }, function (templateErr, html) {
if (!templateErr) { if (!templateErr) {
return res.send(code, html); return res.status(code).send(html);
} }
// There was an error trying to render the error page, output the error // There was an error trying to render the error page, output the error
self.logError(templateErr, 'Error whilst rendering error page', 'Error template has an error'); self.logError(templateErr, 'Error whilst rendering error page', 'Error template has an error');
// And then try to explain things to the user... // And then try to explain things to the user...
// Cheat and output the error using handlebars escapeExpression // Cheat and output the error using handlebars escapeExpression
return res.send(500, return res.status(500).send(
'<h1>Oops, seems there is an an error in the error template.</h1>' + '<h1>Oops, seems there is an an error in the error template.</h1>' +
'<p>Encountered the error: </p>' + '<p>Encountered the error: </p>' +
'<pre>' + hbs.handlebars.Utils.escapeExpression(templateErr.message || templateErr) + '</pre>' + '<pre>' + hbs.handlebars.Utils.escapeExpression(templateErr.message || templateErr) + '</pre>' +
@ -268,7 +268,7 @@ errors = {
if (req.method === 'GET') { if (req.method === 'GET') {
this.renderErrorPage(404, message, req, res, next); this.renderErrorPage(404, message, req, res, next);
} else { } else {
res.send(404, message); res.status(404).send(message);
} }
}, },
@ -304,7 +304,7 @@ errors = {
returnErrors.push(errorContent); returnErrors.push(errorContent);
}); });
res.json(statusCode, {errors: returnErrors}); res.status(statusCode).json({errors: returnErrors});
} }
} }
}; };

View file

@ -64,7 +64,7 @@ function ghostBusBoy(req, res, next) {
busboy.on('error', function (error) { busboy.on('error', function (error) {
console.log('Error', 'Something went wrong parsing the form', error); console.log('Error', 'Something went wrong parsing the form', error);
res.send(500, {code: 500, message: 'Could not parse upload completely.'}); res.status(500).send({code: 500, message: 'Could not parse upload completely.'});
}); });
busboy.on('field', function (fieldname, val) { busboy.on('field', function (fieldname, val) {

View file

@ -172,7 +172,7 @@ function checkSSL(req, res, next) {
// Check if forceAdminSSL: { redirect: false } is set, which means // Check if forceAdminSSL: { redirect: false } is set, which means
// we should just deny non-SSL access rather than redirect // we should just deny non-SSL access rather than redirect
if (forceAdminSSL && forceAdminSSL.redirect !== undefined && !forceAdminSSL.redirect) { if (forceAdminSSL && forceAdminSSL.redirect !== undefined && !forceAdminSSL.redirect) {
return res.send(403); return res.status(403).end();
} }
redirectUrl = url.parse(config.urlSSL || config.url); redirectUrl = url.parse(config.urlSSL || config.url);
@ -285,7 +285,7 @@ setupMiddleware = function (server) {
// Body parsing // Body parsing
expressServer.use(bodyParser.json()); expressServer.use(bodyParser.json());
expressServer.use(bodyParser.urlencoded()); expressServer.use(bodyParser.urlencoded({ extended: true }));
expressServer.use(passport.initialize()); expressServer.use(passport.initialize());

View file

@ -61,7 +61,7 @@ CasperTest.begin('Ensures dated permalinks works with RSS', 2, function suite(te
CasperTest.begin('Ensure that character set is UTF-8 for RSS feed', 1, function suite(test) { CasperTest.begin('Ensure that character set is UTF-8 for RSS feed', 1, function suite(test) {
CasperTest.Routines.togglePermalinks.run('off'); CasperTest.Routines.togglePermalinks.run('off');
casper.thenOpen(url + 'rss/', function (response) { casper.thenOpen(url + 'rss/', function (response) {
test.assertEqual(response.headers.get('Content-Type'), 'text/xml; charset=UTF-8', 'Content type should include UTF-8 character set encoding.'); test.assertEqual(response.headers.get('Content-Type'), 'text/xml; charset=utf-8', 'Content type should include UTF-8 character set encoding.');
}); });
}, false); }, false);

View file

@ -32,7 +32,7 @@
"engineStrict": true, "engineStrict": true,
"dependencies": { "dependencies": {
"bcryptjs": "0.7.10", "bcryptjs": "0.7.10",
"body-parser": "1.0.2", "body-parser": "1.6.3",
"bookshelf": "0.7.6", "bookshelf": "0.7.6",
"busboy": "0.2.3", "busboy": "0.2.3",
"colors": "0.6.2", "colors": "0.6.2",
@ -41,7 +41,7 @@
"connect-slashes": "1.2.0", "connect-slashes": "1.2.0",
"cookie-parser": "1.0.1", "cookie-parser": "1.0.1",
"downsize": "0.0.5", "downsize": "0.0.5",
"express": "4.1.1", "express": "4.8.3",
"express-hbs": "0.7.10", "express-hbs": "0.7.10",
"express-session": "1.0.4", "express-session": "1.0.4",
"fs-extra": "0.8.1", "fs-extra": "0.8.1",