adapt-authoring-server 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Router.js CHANGED
@@ -79,6 +79,9 @@ class Router {
79
79
  if (_.isString(this.parentRouter.path)) {
80
80
  p += this.parentRouter.path
81
81
  }
82
+ if (p[p.length - 1] === '/' && this.root[0] === '/') {
83
+ return p + this.root.slice(1)
84
+ }
82
85
  if (p[p.length - 1] !== '/' && this.root[0] !== '/') {
83
86
  p += '/'
84
87
  }
@@ -183,7 +183,7 @@ class ServerUtils {
183
183
  }
184
184
  ['body', 'params', 'query'].forEach(attr => {
185
185
  if (!req[attr]) {
186
- return storeVal(attr, true)
186
+ return storeVal(attr, false)
187
187
  }
188
188
  const entries = Object.entries(req[attr])
189
189
  let deleted = 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapt-authoring-server",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Provides an Express application routing and more",
5
5
  "homepage": "https://github.com/adapt-security/adapt-authoring-server",
6
6
  "license": "GPL-3.0",
@@ -98,7 +98,7 @@ describe('Router', () => {
98
98
  const childRouter = new Router('/users', parentRouter)
99
99
 
100
100
  // Documents existing behavior: double slashes are allowed
101
- assert.equal(childRouter.path, '/api//users')
101
+ assert.equal(childRouter.path, '/api/users')
102
102
  })
103
103
 
104
104
  it('should handle root path without parent path property', () => {
@@ -76,9 +76,9 @@ describe('ServerUtils', () => {
76
76
 
77
77
  ServerUtils.addExistenceProps(req, res, next)
78
78
 
79
- assert.equal(req.hasBody, true)
80
- assert.equal(req.hasParams, true)
81
- assert.equal(req.hasQuery, true)
79
+ assert.equal(req.hasBody, false)
80
+ assert.equal(req.hasParams, false)
81
+ assert.equal(req.hasQuery, false)
82
82
  })
83
83
 
84
84
  it('should mark has* false when all entries are null or undefined', () => {
File without changes