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
{{ message }}
This repository was archived by the owner on Nov 11, 2023. It is now read-only.
Describe the bug
When useGet hook is intialised with options lazy: true and mock: { ... }, calling refetch returns the mock response, but still makes the network call. This works in the browser, but causes issues in test environments where making API calls is not allowed.
Eg. Jest running in JSDom env fails with the error ReferenceError: Request is not defined and the following stack trace:
ReferenceError: Request is not defined
at _temp2 (/Users/abhinavrastogi/project/node_modules/restful-react/src/useGet.tsx:172:23)
at requestOptions (/Users/abhinavrastogi/project/node_modules/restful-react/src/useGet.tsx:167:19)
at fetchData (/Users/abhinavrastogi/project/node_modules/restful-react/src/useGet.tsx:163:84)
at /Users/abhinavrastogi/project/node_modules/restful-react/src/useGet.tsx:285:7
Describe the bug
When
useGethook is intialised with optionslazy: trueandmock: { ... }, callingrefetchreturns the mock response, but still makes the network call. This works in the browser, but causes issues in test environments where making API calls is not allowed.Eg. Jest running in JSDom env fails with the error
ReferenceError: Request is not definedand the following stack trace:To Reproduce
Steps to reproduce the behavior:
Expected behavior
Calling
refetchwhenmockis present, should not trigger the actual network call.Screenshots
N/A
Desktop (please complete the following information):
Additional context
N/A