Skip to content

Commit

Permalink
Change query parser setting default to 'simple'
Browse files Browse the repository at this point in the history
closes #3361
closes #3621
  • Loading branch information
czaarek99 authored and dougwilson committed Dec 18, 2021
1 parent af341b0 commit 450c468
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions test/req.query.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 450c468

Please sign in to comment.