Add delay before each request #2060
-
ScopeAdds a new behavior Compatibility
Feature descriptionI want to have what was described here #260 , but isn't usable anymore since V2. Basically add a I tried using the lifecycle methods but had no success. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
https://mswjs.io/docs/api/delay |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
Hi, @primeapple. Since this is a common question, I've added a new Global response delay recipe to the docs. It will guide you through two main options on how to achieve the global delay you describe. Please refer to those options and choose the one that suits you the most. |
Beta Was this translation helpful? Give feedback.
Hi, @primeapple.
Since this is a common question, I've added a new Global response delay recipe to the docs. It will guide you through two main options on how to achieve the global delay you describe. Please refer to those options and choose the one that suits you the most.