Skip to content

Commit 811bba7

Browse files
committed
Play: Add info about random_faliure_rate.
1 parent ea40a3a commit 811bba7

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

docs/play.mdx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,31 @@ You can change it to the following URL to make it respond with the same body it
7272
https://api.play.svix.com/api/v1/in/e_94XdF-OwN3EaTKty4izJDWRAH3V/?echo_body=true
7373
```
7474

75+
### Random Failure Rate
76+
77+
Svix Play supports simulating random failures to help you test how your webhook system handles intermittent issues. This is useful for testing retry logic, error handling, and system resilience.
78+
79+
You can use the `random_failure_rate` query parameter to specify a percentage (0-100) of requests that should randomly fail. When a request fails, it will use the status code from `force_status_code` if provided, or default to `400 Bad Request` if not set.
80+
81+
For example, if your URL was:
82+
83+
```
84+
https://api.play.svix.com/api/v1/in/e_94XdF-OwN3EaTKty4izJDWRAH3V/
85+
```
86+
87+
You can change it to the following URL to make 30% of requests fail with a `400 Bad Request`:
88+
89+
```
90+
https://api.play.svix.com/api/v1/in/e_94XdF-OwN3EaTKty4izJDWRAH3V/?random_failure_rate=30
91+
```
92+
93+
Or combine it with `force_status_code` to use a specific error code for the failures:
94+
95+
```
96+
https://api.play.svix.com/api/v1/in/e_94XdF-OwN3EaTKty4izJDWRAH3V/?random_failure_rate=30&force_status_code=503
97+
```
98+
99+
This will make 30% of requests fail with a `503 Service Unavailable` status.
75100

76101
### Programmatic Use of the Public API
77102

@@ -89,7 +114,7 @@ Next, send any number of events to the following route with any HTTP method:
89114
https://api.play.svix.com/api/v1/in/{your token here}/
90115
```
91116

92-
This route can take the query parameters `force_status_code`, `echo_body`, and `endpoint_signing_key`.
117+
This route can take the query parameters `force_status_code`, `random_failure_rate`, `echo_body`, and `endpoint_signing_key`.
93118

94119
Next, you'll want to analyze the record of events for this token using the `/history/` route as follows:
95120

0 commit comments

Comments
 (0)