fetch is replacing xhr. I wonder if sinonjs could contain a fakeFetch that will work with fakeServer? github implements a fetch polyfill, could it be leveraged to implement the fake fetch?
Instead of stuffing more into Sinon.JS, I'd rather see it implemented as a separate module. This module could offer integration with Sinon.JS.
Isn't the plan to move the whole fake server into a separate module? And why shouldn't fetch be part of that module? I'm wondering where we want to draw the line.
Isn't the plan to move the whole fake server into a separate module?
That was my understanding
And why shouldn't fetch be part of that module? I'm wondering where we want to draw the line.
As long as it's not in Sinon.JS directly, I am happy. Whether we make one module to rule them all, or many small(er) modules is not that important to me
:+1:
Thanks for the heads up. Sounds reasonable.
So what the separate fake server module will look like (and when will it happen)? I doubt fake fetch could be implemented without this module in place.
:+1: very excited on having this feature
It would be nice to add this feature :+1:
:+1: for fakeFetch
Question for people that want this feature, is the expectation that you'd be able to call fakeServer.respondWith(...) and the server would fake the response for request for XMLHttpRequest and fetch? Or would it be that you create a server for each type?
This doesn't seem like it would be a crazy amount of work to implement.
Hello
To my point of vue, I only use fetch. Thus the reply to your questions would be: anyway are good for me.
But since not all the browser support fetch, some people use polyfill for fetch, based on XmlHttpRequest.
I would thus suggest more of fake response for both toguether to ease testing all browser the same way...
Did you start working on this?
Have a nice day!
@ibash I think your first proposal is the soundest. One server to rule them all. It is just HTTP after all.
Any update to this feature?
@darrenfu no. someone needs to put in the hours. You do not have to wait for a separate repo or module for this to be implemented either (which @hgl hinted at). Just interface with the existing module that lives in Sinon. Later on those server bits could of course be extracted.
I would recommend looking at these libraries for faking fetch
Since no one has stepped up to resolve this issue with a PR for more than two years, I am closing it