Closed daumann closed 7 years ago
What if you loose the ^
?
@fzaninotto if I change it to fetchMock.mock('http://fakeapi', restServer.getHandler())
all requests (even those ment for http://fakeapi) throw that Uncaught Error above.
And how did you initialize your restServer
?
@fzaninotto
const restServer = new FakeRest.FetchServer('http://fakeapi');
Then I suspect a bug in the fetch-mock
package, which is a dependency...
Adding a .spy():
fetchMock.mock('^http://fakeapi', restServer.getHandler()).spy()
did the trick. This lets other URLs through. Thanks for sending me to fetch-mock, that's where I found it.
I have set up fakerest with
fetchMock.mock('^http://fakeapi', restServer.getHandler())
Now when I want to test my auth api, I have a request going out fetch(request) with request being:
Request {method: "POST", url: "http://localhost:4040/v1/auth/login", ...
Unfortunately the request does not go out but gets intercepted and results in the error:
Is there a way to let requests to a specific host through?