From 7bca2737d207189e6df65d1fee6fc735d370114e Mon Sep 17 00:00:00 2001 From: Czarek Date: Sun, 15 Apr 2018 10:29:03 +0200 Subject: [PATCH] Change query parser setting default to `'simple'` closes #3361 closes #3621 --- History.md | 2 ++ lib/application.js | 2 +- test/req.query.js | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/History.md b/History.md index 9e5d35ce59..028317d933 100644 --- a/History.md +++ b/History.md @@ -3,6 +3,8 @@ This incorporates all changes after 4.17.1 up to 4.17.2. + * change: + - query parser setting defaults to `'simple'` * deps: body-parser@2.0.0-beta.1 - `req.body` is no longer always initialized to `{}` - `urlencoded` parser now defaults `extended` to `false` diff --git a/lib/application.js b/lib/application.js index c4d69e9ed6..85967249c4 100644 --- a/lib/application.js +++ b/lib/application.js @@ -89,7 +89,7 @@ app.defaultConfiguration = function defaultConfiguration() { this.enable('x-powered-by'); this.set('etag', 'weak'); this.set('env', env); - this.set('query parser', 'extended'); + this.set('query parser', 'simple') this.set('subdomain offset', 2); this.set('trust proxy', false); diff --git a/test/req.query.js b/test/req.query.js index 869fbc360b..067d452107 100644 --- a/test/req.query.js +++ b/test/req.query.js @@ -12,12 +12,12 @@ describe('req', function(){ .expect(200, '{}', done); }); - it('should default to parse complex keys', function (done) { + it('should default to parse simple keys', function (done) { var app = createApp(); request(app) .get('/?user[name]=tj') - .expect(200, '{"user":{"name":"tj"}}', done); + .expect(200, '{"user[name]":"tj"}', done); }); describe('when "query parser" is extended', function () {