Status and Delay
Looking Glass answers 200 straight away, unless the request asks for something else. Ask for a 503 or a slow answer to see how a proxy, a retry loop or a timeout really behaves.
At a Glance
- Looking Glass running (see Getting Started).
- The
X-Glass-StatusandX-Glass-Delayheaders.
Pick a Status
curl -i 'localhost:8080/checkout' -H 'X-Glass-Status: 503'Any status from 200 to 599 works, and the request is still reflected in the body. A 204 or 304 has no body, since HTTP doesn't allow one.
Answer Slowly
curl 'localhost:8080/checkout' -H 'X-Glass-Delay: 2.5s'The delay is a Go duration (300ms, 2.5s, 1m) or a plain number of seconds (2.5). It's capped at 10 seconds by default; raise the cap with --max-delay (see Configuration).
The two headers combine, so a slow 504 is one request:
curl -i 'localhost:8080/checkout' -H 'X-Glass-Status: 504' -H 'X-Glass-Delay: 8s'Headers Only
There is no query param for either, because ?status=open or ?delay=5 already mean something to the services Looking Glass stands in for. A query param named status or delay is just reflected.
A status outside 200–599, or a delay that isn't a duration or is longer than the cap, is answered with 400 and the reason, so a typo can't pass as a real answer.
Next Steps
- Cross-Origin Requests: send these headers from a page.
- Activity Log: each line shows the status the request got.