Best way to simulate offline mode while developing? #704
Answered
by
kettanaito
cmacdonnacha
asked this question in
Q&A
-
I've been using MSW to mock my test data while developing locally. It's been great so far but I was wondering how I can simulate "offline mode" to see how my app responds to failed requests. Is it possible to use the Network tab in Chrome dev tools to do so? |
Beta Was this translation helpful? Give feedback.
Answered by
kettanaito
Apr 20, 2021
Replies: 1 comment 8 replies
-
Hey, @cmacdonnacha. You can simulate an offline mode using the rest.get('/user', (req, res, ctx) => {
return res.networkError('Your error message')
})
This produces an analogous response error as when requesting a resource while being offline. |
Beta Was this translation helpful? Give feedback.
8 replies
Answer selected by
cmacdonnacha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, @cmacdonnacha.
You can simulate an offline mode using the
res.networkError()
utility.This produces an analogous response error as when requesting a resource while being offline.