@naturalcycles/backend-lib 9.47.0 → 9.47.1

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.
@@ -2,7 +2,7 @@ import { AjvSchema, getCoercingAjv, } from '@naturalcycles/nodejs-lib/ajv';
2
2
  import { handleValidationError } from '../validateRequest.util.js';
3
3
  class AjvValidateRequest {
4
4
  body(req, schema, opt = {}) {
5
- return this.validate(req, 'body', schema, req.rawBody ? () => JSON.parse(req.rawBody.toString()) : undefined, opt);
5
+ return this.validate(req, 'body', schema, req.rawBody?.byteLength ? () => JSON.parse(req.rawBody.toString()) : undefined, opt);
6
6
  }
7
7
  /**
8
8
  * Query validation uses type coercion (unlike body validation),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
3
  "type": "module",
4
- "version": "9.47.0",
4
+ "version": "9.47.1",
5
5
  "peerDependencies": {
6
6
  "@sentry/node": "^10"
7
7
  },
@@ -36,7 +36,7 @@
36
36
  "@sentry/node": "^10",
37
37
  "@types/ejs": "^3",
38
38
  "fastify": "^5",
39
- "@naturalcycles/dev-lib": "18.4.2"
39
+ "@naturalcycles/dev-lib": "20.23.0"
40
40
  },
41
41
  "exports": {
42
42
  ".": "./dist/index.js",
@@ -17,7 +17,7 @@ class AjvValidateRequest {
17
17
  req,
18
18
  'body',
19
19
  schema,
20
- req.rawBody ? () => JSON.parse(req.rawBody!.toString()) : undefined,
20
+ req.rawBody?.byteLength ? () => JSON.parse(req.rawBody!.toString()) : undefined,
21
21
  opt,
22
22
  )
23
23
  }