Skip to content

Commit 3187f92

Browse files
authored
Update IS_MAYBE_MIRAGE function to check for Mirage in development mode (#9254)
1 parent ab09984 commit 3187f92

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/request/src/fetch.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
* @module @ember-data/request/fetch
1212
* @main @ember-data/request/fetch
1313
*/
14-
import { getOwnConfig, macroCondition } from '@embroider/macros';
14+
15+
import { DEBUG } from '@ember-data/env';
1516

1617
import { cloneResponseProperties, type Context } from './-private/context';
1718
import type { HttpErrorProps } from './-private/utils';
@@ -34,9 +35,13 @@ function cloneResponse(response: Response, overrides: Partial<Response>) {
3435
}
3536

3637
let IS_MAYBE_MIRAGE = () => false;
37-
if (macroCondition(getOwnConfig<{ env: { TESTING: boolean } }>().env.TESTING)) {
38+
if (DEBUG) {
3839
IS_MAYBE_MIRAGE = () =>
39-
Boolean(typeof window !== 'undefined' && (window as { server?: { pretender: unknown } }).server?.pretender);
40+
Boolean(
41+
typeof window !== 'undefined' &&
42+
((window as { server?: { pretender: unknown } }).server?.pretender ||
43+
window.fetch.toString() !== 'function fetch() { [native code] }')
44+
);
4045
}
4146

4247
const MUTATION_OPS = new Set(['updateRecord', 'createRecord', 'deleteRecord']);

0 commit comments

Comments
 (0)