Consider Adding a 429 Response
It'd be great to be able to use this service to simulate 429 TOO MANY REQUESTS errors, in a format like this: https://httpstatuses.com/429.
Could do something like /too-many-requests/:number where :number is the number of seconds to put in the retry-after header. If it's agreed that this is a good feature to have, I'd be willing to put together a pull request.
Thanks for considering!
you can use http://httpbin.org/status/429 already no ?
Yes, but it doesn't populate a Retry-After header (per https://tools.ietf.org/html/rfc6585#section-4) or X-RateLimit-Limit/X-RateLimit-Remaining/X-RateLimit-Reset headers, so it's difficult to use it in place of a properly rate limited API.
This could be a special case on the 429 code where it populates these headers as well, that would make lots of sense, too!
What’s really needed is a way to combine multiple endpoints. All you need for this special case is a combination of the existing status and response-headers endpoints.
Yes, it's duplicate of more general #612
(shamless plug) note you can do that with fortio :p
$ curl -v "localhost:8080/?status=429&header=Retry-After:60"
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /?status=429&header=Retry-After:60 HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 429 Too Many Requests
< Retry-After: 60
< Date: Wed, 20 Oct 2021 18:24:15 GMT
< Content-Length: 0
<
* Connection #0 to host localhost left intact
* Closing connection 0
https://github.com/fortio/fortio#server-urls-and-features