Installation (requires node.js, which comes with npm
):
git clone https://github.com/chesles/test-server.git
cd test-server
npm install
npm start
If all goes well you'll have a server running on port 2700
Make a request take longer with the delay
parameter:
curl localhost:2700?delay=2000
enforce unique parameters between requests with enforce_unique=true
and unique_keys
(a comma-separated list).
Once this request is made
curl -v localhost:2700?enforce_unique=true&unique_keys=id,username \
-d "id=1" -d "username=foo"
This one will be OK:
curl -v localhost:2700?enforce_unique=true&unique_keys=id,username \
-d "id=2" -d "username=bar"
...and this one will return a 500 error (because id=1
has already been passed:
curl -v localhost:2700?enforce_unique=true&unique_keys=id,username \
-d "id=1" -d "username=blah"
Kill & restart the server to clear the set of values that have been seen.
Pass a location
and an optional responsecode
parameter to make test-server
return a redirect:
curl localhostT:2700 -d location=http://google.com -d responsecode=301
responsecode
defaults to 302 if location
is present.
- set the status code
- set cookies
- set headers
- other?