-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there anyway to delay the response time? #647
Comments
Check CLI usage, you can add |
how can i add it in |
Please give us back |
Not sure why delay was removed. "use Chrome's Network tab > throttling to delay requests instead of --delay CLI option". What if I used json-server in Next 14 app dir, where I fetch data on the server? How I'm supposed to enable throttling there? |
You can do it like this: const sleep = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms));
await sleep(5000)
await fetch(...) And if you're using something like axios, probably with an interceptor. There's more control over which request should have a delay or not. On macOS, you have Network Link Conditioner as well. |
i've raised this PR. meanwhile, I made the same changes locally in the globally installed package and is working fine. You can check the PR and do the same if you don't wanna wait 🤓 |
I would like to delay the response time about 30s for testing loading case. Is it possible?
The text was updated successfully, but these errors were encountered: