@midwayjs/mock 3.10.10 → 3.10.13
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/dist/creator.js +14 -3
- package/package.json +2 -2
package/dist/creator.js
CHANGED
|
@@ -129,7 +129,13 @@ async function create(appDir = process.cwd(), options, customFramework) {
|
|
|
129
129
|
}
|
|
130
130
|
else {
|
|
131
131
|
const frameworkService = await container.getAsync(core_1.MidwayFrameworkService);
|
|
132
|
-
|
|
132
|
+
const mainFramework = frameworkService.getMainFramework();
|
|
133
|
+
if (mainFramework) {
|
|
134
|
+
return mainFramework;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
throw new Error('Can not get main framework, please check your configuration.ts.');
|
|
138
|
+
}
|
|
133
139
|
}
|
|
134
140
|
}
|
|
135
141
|
catch (err) {
|
|
@@ -256,7 +262,7 @@ async function createFunctionApp(baseDir = process.cwd(), options = {}, customFr
|
|
|
256
262
|
const result = await framework.invokeTriggerFunction(ctx, url.pathname, {
|
|
257
263
|
isHttpFunction: true,
|
|
258
264
|
});
|
|
259
|
-
const { statusCode, headers, body } = result;
|
|
265
|
+
const { statusCode, headers, body, isBase64Encoded } = result;
|
|
260
266
|
if (res.headersSent) {
|
|
261
267
|
return;
|
|
262
268
|
}
|
|
@@ -267,7 +273,12 @@ async function createFunctionApp(baseDir = process.cwd(), options = {}, customFr
|
|
|
267
273
|
res.statusCode = statusCode;
|
|
268
274
|
}
|
|
269
275
|
// http trigger only support `Buffer` or a `string` or a `stream.Readable`
|
|
270
|
-
|
|
276
|
+
if (isBase64Encoded && typeof body === 'string') {
|
|
277
|
+
res.end(Buffer.from(body, 'base64'));
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
res.end(body);
|
|
281
|
+
}
|
|
271
282
|
};
|
|
272
283
|
};
|
|
273
284
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/mock",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.13",
|
|
4
4
|
"description": "create your test app from midway framework",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"type": "git",
|
|
50
50
|
"url": "https://github.com/midwayjs/midway.git"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "6052ab52c7973f092a4acc943707d7b4cac16bd2"
|
|
53
53
|
}
|