Skip to content

Commit effadea

Browse files
fix: empty-node-fetch-response
Signed-off-by: Shreyansh Shah <shreyansh_shah@yahoo.com>
1 parent 10ff4eb commit effadea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

integrations/node-fetch/require.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import Hook from "require-in-the-middle";
44
import { Headers, ResponseInit } from "node-fetch";
55
import mixin from "merge-descriptors";
6-
import { getExecutionContext } from "../../src/context";
6+
import { createExecutionContext,getExecutionContext } from "../../src/context";
77
import { Readable } from "stream";
88
import { ProcessDep, stringToBinary } from "../../src/util";
99
import { putMocks } from "../../mock/utils";
@@ -12,6 +12,7 @@ import { getRequestHeader, getResponseHeader } from "../express/middleware";
1212
import { getReasonPhrase } from "http-status-codes";
1313
import { DataBytes } from "../../proto/services/DataBytes";
1414
import { MockIds } from "../../mock/mock";
15+
import { MODE_OFF } from "../../src/mode";
1516

1617
// @ts-ignore
1718
Hook(["node-fetch"], function (exported) {
@@ -37,6 +38,9 @@ export function wrappedNodeFetch(fetch: any) {
3738
url: any,
3839
options: any
3940
) {
41+
if (process.env.KEPLOY_MODE == MODE_OFF) {
42+
createExecutionContext({ mode: MODE_OFF });
43+
}
4044
if (
4145
getExecutionContext() == undefined ||
4246
getExecutionContext().context == undefined

0 commit comments

Comments
 (0)