Skip to content

Commit

Permalink
4.0.1: req.query bug fix and new test
Browse files Browse the repository at this point in the history
  • Loading branch information
schamberg97 committed Sep 30, 2021
1 parent 01dffb2 commit ba8e40f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/routing/sequential.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ module.exports = (config = {}) => {
req.path = split[0]

const queryparse = req.app.__settings.get('query parser fn')
req.search = '?' + split[1]
req.query = queryparse(split[1])
const query = split.slice(1).join('?')
req.search = '?' + query
req.query = queryparse(query)

res.locals = Object.create(null) // res.locals is rather convenient at times, so we leave it on even for API routes
req.paramsCalled = {} // needed for app.param
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fyrejet",
"version": "4.0.0",
"version": "4.0.1",
"description": "Web Framework for node.js that strives to provide (almost) perfect compatibility with Express, while providing better performance, where you need it.",
"main": "index.js",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions test/req.query.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ describe('req', function () {
.expect(200, '{}', done)
})

it('should handle another "?" in the query', function (done) {
var app = createApp()
request(app)
.get('/?dogs=true?cats=true')
.expect(200, '{"dogs":"true?cats=true"}', done)
})

it('should default to parse complex keys', function (done) {
var app = createApp()

Expand Down

0 comments on commit ba8e40f

Please sign in to comment.