You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fetch-mock has a function patchNativeFetchForSafari that wraps the native fetch when it detects it's running in Safari. By a funny coincidence, what fetch-mock looks for is exactly how jsdom identifies itself.
The side effect is that, when jsdom-global is loaded, the patchNativeFetchForSafari function only passes the first argument on to the nativeFetch function. Like so:
Either the detection needs to be more specific, nativeFetch should be called as nativeFetch.apply(arguments), or both. For my purposes, my workaround will probably be navigator = { vendor: 'Compy' };.
The text was updated successfully, but these errors were encountered:
fluggo
pushed a commit
to fluggo/fetch-mock
that referenced
this issue
May 15, 2021
This is not a great fix; it ignores that method is only inspected when it's
in the first fetch() parameter, and it glosses over the fact that the
navigator object, for historical reasons, is very constrained in the
responses it gives (which is why the code snagged jsdom in the first
place).
It does, however, solve my immediate need of getting fetch-mock to
interoperate with jsdom.
Fixeswheresrhys#608
fetch-mock has a function patchNativeFetchForSafari that wraps the native fetch when it detects it's running in Safari. By a funny coincidence, what fetch-mock looks for is exactly how jsdom identifies itself.
The side effect is that, when jsdom-global is loaded, the patchNativeFetchForSafari function only passes the first argument on to the nativeFetch function. Like so:
Produces:
...leaving out the specified header.
Either the detection needs to be more specific, nativeFetch should be called as
nativeFetch.apply(arguments)
, or both. For my purposes, my workaround will probably benavigator = { vendor: 'Compy' };
.The text was updated successfully, but these errors were encountered: