@orion-js/http 3.3.14 → 3.3.18

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.
@@ -4,7 +4,16 @@ exports.executeRequest = void 0;
4
4
  const errors_1 = require("../errors");
5
5
  const viewer_1 = require("./../viewer");
6
6
  const lodash_1 = require("lodash");
7
+ const env_1 = require("@orion-js/env");
8
+ const helpers_1 = require("@orion-js/helpers");
9
+ const simulateLatency = (0, env_1.internalGetEnv)('simulate_latency', 'SIMULATE_LATENCY');
7
10
  async function executeRequest(route, req, res) {
11
+ if (simulateLatency) {
12
+ const time = parseInt(simulateLatency);
13
+ if (time) {
14
+ await (0, helpers_1.sleep)((0, lodash_1.random)(time * 0.9, time * 1.1));
15
+ }
16
+ }
8
17
  try {
9
18
  const viewer = await (0, viewer_1.getViewer)(req);
10
19
  const result = await route.resolve(req, res, viewer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/http",
3
- "version": "3.3.14",
3
+ "version": "3.3.18",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "files": [
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "52d669169a12e27c602733c32bf19fdb390f971a"
45
+ "gitHead": "caf7a903e301c1bcfec24617f74396703ca6a05c"
46
46
  }