A test service to mock a slow api response; responds to get and post methods
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app Add CORS support (#6) Oct 1, 2016
log
public/assets Add CORS support (#6) Oct 1, 2016
spec
.coveralls.yml add coverall conf Mar 3, 2015
.dockerignore
.gitignore
.rspec
.rubocop.yml
.ruby-version
.travis.yml
Gemfile
Gemfile.lock Bundle update Apr 1, 2017
LICENSE
Procfile
README.md
Rakefile
app.rb
config.ru
package.json
puma.rb

README.md

Slowwly

A test service to mock a slow http response.

Build Status Dependency Status

Description

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

Try it out

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

Mantra

This project aims to;

  • Provide delayed response for at least GET and POST 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 ;)

Getting started

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.

API

Request

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

Response

Slowwly responds to the following HTTP methods as below;

GET
Responds with HTTP302
POST
Responds with HTTP307

Examples

# 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

Development / Deployment

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>

Contributions

Please use the GitHub pull-request mechanism to submit contributions.

License

This project is available for use under the MIT software license. See LICENSE