A test service to mock a slow api response - simply prepend your Slowwly URL with delay configuration to your usual API URL and make a request, the response will be delayed.
This can be used to simulate timeouts so that you can see how your application responds with slow API requests or if it fails where you expect it to fail.
There are other services doing this but Slowwly will respond to POST
requests as well as GET
.
Example URL with request delayed by 2 seconds - http://localhost:9292/delay/2000/url/http://google.co.uk
Slowwly is deployed @http://slowwly.robertomurray.co.uk/ so go ahead and use it or run locally.
Example URL with request delayed by 2.5 seconds - http://slowwly.robertomurray.co.uk/delay/2500/url/http://google.co.uk
This project aims to;
- Provide delayed response for at least
GET
andPOST
requests - Not intefere too much with calling code making the request. We don't want users to have to modify request params to use this, editing code just to test something is a pain - the request host or URL should be the minimum required change to use this.
- Return redirect after delay; It is useful to actually see how you code works with the real response returned after a delay. Note: obviously requires clients to follow redirects ;)
It's a simple Rack app so you can run it anywhere;
$ git clone git@github.com:rob-murray/slowwly.git
$ cd slowwly
$ rackup
# Or with foreman
$ foreman start
Feel free to run it anywhere you need or use the existing deployed service here.
Build a URL with the following params:
http://{host}/delay/{delay_time}/url/{url}
host
- The host where this app is running
delay_time
- Time to delay response in milliseconds
url
- The URL to redirect to via response
Slowwly responds to the following HTTP methods as below;
- GET
- Responds with HTTP
302
- POST
- Responds with HTTP
307
# a simple get request with 1 second delay
$ curl -i http://localhost:9292/delay/1000/url/https://www.google.co.uk
HTTP/1.1 302 Found
Content-Type: text/html;charset=utf-8
Location: https://www.google.co.uk
Content-Length: 0
# etc
# a post request with some data and a 3 second delay
$ curl -i --data "param1=value1" http://localhost:9292/delay/3000/url/http://myapi.com/endpoint
HTTP/1.1 307 Temporary Redirect
Content-Type: text/html;charset=utf-8
Location: http://myapi.com/endpoint
Content-Length: 0
# etc
This application is available as a latest cool thing Docker image at robmurray/slowwly-web.
Checkout the
docker
branch
Run it yourself with:
docker pull robmurray/slowwly-web
docker build -t <tag>
docker run -d -p 8080:8080 --name <name> -t <tag>
Please use the GitHub pull-request mechanism to submit contributions.
This project is available for use under the MIT software license. See LICENSE