@midwayjs/mock 3.10.11 → 3.10.15

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/dist/creator.js +7 -2
  2. package/package.json +9 -9
package/dist/creator.js CHANGED
@@ -262,7 +262,7 @@ async function createFunctionApp(baseDir = process.cwd(), options = {}, customFr
262
262
  const result = await framework.invokeTriggerFunction(ctx, url.pathname, {
263
263
  isHttpFunction: true,
264
264
  });
265
- const { statusCode, headers, body } = result;
265
+ const { statusCode, headers, body, isBase64Encoded } = result;
266
266
  if (res.headersSent) {
267
267
  return;
268
268
  }
@@ -273,7 +273,12 @@ async function createFunctionApp(baseDir = process.cwd(), options = {}, customFr
273
273
  res.statusCode = statusCode;
274
274
  }
275
275
  // http trigger only support `Buffer` or a `string` or a `stream.Readable`
276
- res.end(body);
276
+ if (isBase64Encoded && typeof body === 'string') {
277
+ res.end(Buffer.from(body, 'base64'));
278
+ }
279
+ else {
280
+ res.end(body);
281
+ }
277
282
  };
278
283
  };
279
284
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/mock",
3
- "version": "3.10.11",
3
+ "version": "3.10.15",
4
4
  "description": "create your test app from midway framework",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index.d.ts",
@@ -27,21 +27,21 @@
27
27
  },
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@midwayjs/core": "^3.10.10",
30
+ "@midwayjs/core": "^3.10.15",
31
31
  "@midwayjs/logger": "^2.15.0",
32
32
  "@types/amqplib": "0.10.1",
33
33
  "amqplib": "0.10.3",
34
- "kafkajs": "2.2.3",
35
- "socket.io": "4.6.0",
36
- "socket.io-client": "4.6.0",
37
- "ws": "8.12.0"
34
+ "kafkajs": "2.2.4",
35
+ "socket.io": "4.6.1",
36
+ "socket.io-client": "4.6.1",
37
+ "ws": "8.12.1"
38
38
  },
39
39
  "dependencies": {
40
- "@midwayjs/async-hooks-context-manager": "^3.10.10",
40
+ "@midwayjs/async-hooks-context-manager": "^3.10.15",
41
41
  "@types/superagent": "4.1.14",
42
42
  "@types/supertest": "2.0.12",
43
43
  "js-yaml": "4.1.0",
44
- "raw-body": "2.5.1",
44
+ "raw-body": "2.5.2",
45
45
  "supertest": "6.3.3"
46
46
  },
47
47
  "author": "Harry Chen <czy88840616@gmail.com>",
@@ -49,5 +49,5 @@
49
49
  "type": "git",
50
50
  "url": "https://github.com/midwayjs/midway.git"
51
51
  },
52
- "gitHead": "df0db0aaa0e3ff168204e3d5cf1c534dccc9b15e"
52
+ "gitHead": "8d5fd0e58156612c675821134377208e4da710ad"
53
53
  }