Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Add delay before each request #2056

Closed
1 task
primeapple opened this issue Feb 23, 2024 · 3 comments
Closed
1 task

Add delay before each request #2056

primeapple opened this issue Feb 23, 2024 · 3 comments
Labels

Comments

@primeapple
Copy link

primeapple commented Feb 23, 2024

Scope

Adds a new behavior

Compatibility

  • This is a breaking change

Feature description

I want to have what was described here #260 , but isn't usable anymore since V2.

Basically add a delay() before each request. What would the suggested approach to this be?

I tried using the lifecycle methods but had no success.

@ZeroCho
Copy link
Contributor

ZeroCho commented Feb 26, 2024

https://mswjs.io/docs/api/delay
Have you tried this one?

@primeapple
Copy link
Author

Sure, but it requires me to manually set a delay for each handler, which is not what I want. I want a delay before EVERY request.

@mattcosta7
Copy link
Contributor

You can do something like a higher-order resolver similar to these:

https://mswjs.io/docs/recipes/higher-order-resolver. It still requires manually wrapping each handler's resolver with that per handled request, but provides a good mechanism for handling those

@mswjs mswjs locked and limited conversation to collaborators Feb 28, 2024
@kettanaito kettanaito converted this issue into discussion #2060 Feb 28, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

3 participants