A timeout is the client's own deadline. Without one, a request to a server that never answers can hold a connection, a thread and the user's patience indefinitely. Timeouts usually come in parts: how long to wait to connect, how long to wait for the first byte, and how long the whole exchange may take.
When the deadline passes, the client aborts and reports an error — in the browser through AbortController, in most libraries as a timeout exception. Every hop has its own: browser, CDN, load balancer, gateway and application. When an inner timeout is longer than an outer one, the outer layer gives up first and the work inside carries on with nobody waiting for it.
That a timed-out request did not happen. The server may have received it and completed it after the client stopped listening; a timed-out POST may have created the order. Treat a timeout as "unknown outcome", and make writes safe to retry with an idempotency key.
GET /protocol/v1/gateway-timeout waits about three seconds before answering 504, and GET /pizza/v1/oven/preheat takes about three seconds before succeeding — set a two-second client timeout and compare what each one does.
All glossary terms · Testing techniques · All 39 mock REST APIs
Last updated