You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/src/content/docs/mock-servers/extended-response-patterns.mdx
+18
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@ The following keys can be used in the response pattern object:
12
12
-`status` (required) - the HTTP status code to return.
13
13
-`headers` - HTTP headers to return with the response.
14
14
-`body` - the body of the response to return. This can be a string, an object (which is treated as JSON), or an `ArrayBuffer`.
15
+
-`delay` - the number of milliseconds to wait before returning the response.
15
16
16
17
The response pattern keys are used to create a new `Response` object that is returned when the associated request pattern matches the request.
17
18
@@ -96,3 +97,20 @@ server.get("/users", {
96
97
```
97
98
98
99
This route will respond to any GET request to `/users` with a status code of 200, a `Content-Type` header of `application/json`, and a JSON response body containing an `id` and `name` property.
100
+
101
+
## Delaying the response
102
+
103
+
If you'd like to delay the response to a request, you can use the `delay` key in the response pattern object. The `delay` property is the number of milliseconds to wait before returning the response. Here's an example:
0 commit comments