ftmocks-utils 1.0.9 → 1.1.0
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/package.json +1 -1
- package/src/index.js +7 -17
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -216,26 +216,16 @@ async function initiatePlaywrightRoutes (page, ftmocksConifg, testName) {
|
|
|
216
216
|
let mockData = getMatchingMockData({testMockData, defaultMockData, url, options, testConfig: ftmocksConifg, testName});
|
|
217
217
|
if (mockData) {
|
|
218
218
|
console.debug('mocked', url, options);
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const { content, headers, status } = mockData.response;
|
|
229
|
-
|
|
230
|
-
const json = {
|
|
231
|
-
status,
|
|
232
|
-
headers,
|
|
233
|
-
json: () => Promise.resolve(JSON.parse(content)),
|
|
234
|
-
};
|
|
219
|
+
const { content, headers, status } = mockData.response;
|
|
220
|
+
const json = {
|
|
221
|
+
status,
|
|
222
|
+
headers,
|
|
223
|
+
body: content,
|
|
224
|
+
};
|
|
235
225
|
|
|
236
|
-
if(json) {
|
|
237
226
|
await route.fulfill(json);
|
|
238
227
|
} else {
|
|
228
|
+
console.debug('missing mock data', url, options);
|
|
239
229
|
await route.fallback();
|
|
240
230
|
}
|
|
241
231
|
});
|