Closed nonopolarity closed 7 months ago
use _dealy
Is this documented anywhere? I can't find any documentation around this even though it works
Is this documented anywhere? I can't find any documentation around this even though it works
use
_dealy
100
so I think you mean use _delay
so it will be
fetch(`https://jsonplaceholder.typicode.com/users/${userID}?_delay=5`)
P.S. The line
fetch(`https://jsonplaceholder.typicode.com/users/${userID}?_delay=5000`)
sometimes has the delay, but sometimes not. (so I am not even sure if it was just a random network delay)
It needs to be 5000 to mean 5 seconds
P.S. The line
fetch(`https://jsonplaceholder.typicode.com/users/${userID}?_delay=5000`)
sometimes has the delay, but sometimes not. (so I am not even sure if it was just a random network delay)
It needs to be 5000 to mean 5 seconds
Might be they optimize ip-base cahce to prevent some DDoS attack.
You can add randome parameter and it should works. (I've just tested with curl)
fetch(`https://jsonplaceholder.typicode.com/users/${userID}?_delay=5000&dummy=${randomNumber()}`)
And yes, it is very strange nothing documented about this.
Hi,
JSONPlaceholder doesn't support _delay
. So addind it does nothing actually.
You can however use the CLI locally with v0.17 json-server --delay 5000 db.json
https://github.com/typicode/json-server/tree/v0.17.4
Or use Chrome's Network tab > throtling
to delay requests.
You can use DummyJSON for this: https://dummyjson.com/docs#intro-delay
fetch('https://dummyjson.com/users/1/?delay=1000');
Can you possibly add a delay so we can do some debugging, such as
so the above can do a 5 seconds delay? Maybe the range can be 0 to 5 so that it doesn't stress your server out. (such as 30 seconds delay which can be a lot of requests bottled up). Alternatively if you want to support millisecond, then maybe
This is for example, if we want to debug / test a slow response, and the user already click on a new link or image that fetches that data faster than the earlier response, so that the earlier response should really be ignored or canceled by our app.