MirageJS - How Do You Add "blob://http://localhost" To Whitelist / Passthrough?

276 Views Asked by At

I have functionality that takes a local base64 URL for an image and converts it to actual base64 data. To do this, I have to call fetch(), followed by an initialization of new FileReader().

When the browser tries to fetch the local base64 URL (ie. blob:http://localhost:3000/41c20923-c818-4e22-a4), Mirage tells me that there was no route configured to handle this request.

I've tried adding the following to my exported mockServer() function:

this.passthrough('blob://http://localhost:3000')
this.passthrough('blob://http://localhost:3000/**')
this.passthrough() (this whitelists all calls to http://localhost:3000)

but none of the above actually whitelists calls to blob:http://localhost. What's the right way to mock out a fetch here?

0

There are 0 best solutions below