We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Users currently can implement response delays by using a computed response handler:
const handler = interceptor .get('/users') .respond(async () => { await new Promise((resolve) => setTimeout(resolve, 1000)) return { status: 200, body: [] } })
We could also allow declarative delays.
A new handler method to declare a fixed or ranged delay. If a range is provided, a random value is selected within that interval.
const handler = interceptor .get('/users') .delay(200) // a fixed delay of 200ms will be used for each request .respond({ status: 200, body: [] }) // ...
const handler = interceptor .get('/users') .delay((request) => { return request.url.includes('slow=true') ? { min: 200, max: 1000 } : 0 }) .respond({ status: 200, body: [] }) // ...
Providing a way to use default delays per interceptor and for all interceptors is also a good idea.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Users currently can implement response delays by using a computed response handler:
We could also allow declarative delays.
Proposal
A new handler method to declare a fixed or ranged delay. If a range is provided, a random value is selected within that interval.
Providing a way to use default delays per interceptor and for all interceptors is also a good idea.
The text was updated successfully, but these errors were encountered: