@ladjs/api 14.1.18 → 14.1.20

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.
Files changed (2) hide show
  1. package/index.js +16 -15
  2. package/package.json +8 -7
package/index.js CHANGED
@@ -145,21 +145,22 @@ class API {
145
145
  // Body parser
146
146
  // POST /v1/logs (1 MB max so 1.1 MB w/overhead)
147
147
  // POST /v1/emails (50 MB max so 51 MB w/overhead)
148
- app.use((ctx, next) => {
149
- // check against ignored paths
150
- if (
151
- Array.isArray(this.config.bodyParserIgnoredPathGlobs) &&
152
- this.config.bodyParserIgnoredPathGlobs.length > 0
153
- ) {
154
- const match = multimatch(
155
- ctx.path,
156
- this.config.bodyParserIgnoredPathGlobs
157
- );
158
- if (Array.isArray(match) && match.length > 0) return next();
159
- }
160
-
161
- return bodyParser()(ctx, next);
162
- });
148
+ if (this.config.bodyParser !== false)
149
+ app.use((ctx, next) => {
150
+ // check against ignored paths
151
+ if (
152
+ Array.isArray(this.config.bodyParserIgnoredPathGlobs) &&
153
+ this.config.bodyParserIgnoredPathGlobs.length > 0
154
+ ) {
155
+ const match = multimatch(
156
+ ctx.path,
157
+ this.config.bodyParserIgnoredPathGlobs
158
+ );
159
+ if (Array.isArray(match) && match.length > 0) return next();
160
+ }
161
+
162
+ return bodyParser(this.config.bodyParser || {})(ctx, next);
163
+ });
163
164
 
164
165
  // Pretty-printed json responses
165
166
  app.use(json());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ladjs/api",
3
3
  "description": "API server for Lad",
4
- "version": "14.1.18",
4
+ "version": "14.1.20",
5
5
  "author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/ladjs/api/issues",
@@ -23,7 +23,7 @@
23
23
  "cabin": "^14.0.0",
24
24
  "express-request-id": "1.4.1",
25
25
  "kcors": "^2.2.2",
26
- "koa": "^2.16.0",
26
+ "koa": "^3.0.0",
27
27
  "koa-404-handler": "^0.1.0",
28
28
  "koa-basic-auth": "^4.0.0",
29
29
  "koa-better-error-handler": "^11.0.4",
@@ -40,22 +40,22 @@
40
40
  "response-time": "^2.3.3"
41
41
  },
42
42
  "devDependencies": {
43
- "@commitlint/cli": "^19.7.1",
44
- "@commitlint/config-conventional": "^19.7.1",
43
+ "@commitlint/cli": "^19.8.1",
44
+ "@commitlint/config-conventional": "^19.8.1",
45
45
  "ava": "^5.3.1",
46
46
  "cross-env": "^7.0.3",
47
47
  "eslint": "^8.55.0",
48
48
  "eslint-config-xo-lass": "^2.0.1",
49
49
  "fixpack": "^4.0.0",
50
50
  "husky": "^9.1.7",
51
- "ioredis": "^5.5.0",
51
+ "ioredis": "^5.6.1",
52
52
  "ioredis-mock": "^8.9.0",
53
53
  "lint-staged": "^15.4.3",
54
54
  "mongoose": "6",
55
55
  "nyc": "^17.1.0",
56
56
  "remark-cli": "11",
57
57
  "remark-preset-github": "^4.0.4",
58
- "supertest": "^7.0.0",
58
+ "supertest": "^7.1.1",
59
59
  "xo": "^0.56.0"
60
60
  },
61
61
  "engines": {
@@ -101,7 +101,8 @@
101
101
  },
102
102
  "scripts": {
103
103
  "lint": "xo --fix && remark . -qfo && fixpack",
104
- "prepare": "husky install",
104
+ "pre-commit": "lint-staged",
105
+ "prepare": "husky",
105
106
  "pretest": "npm run lint",
106
107
  "test": "npm run test-coverage",
107
108
  "test-coverage": "cross-env NODE_ENV=test nyc ava"