"wait" HTTP Preference
The 'wait' HTTP preference informs the maximum duration the client is willing to wait for a response.
Writing requests (clients)
If clients anticipate making a request that will take some time, and would like to limit the amount of time to wait before getting some response from a server, then add a Prefer header with wait=n
to the request, where n
is a whole number in seconds.
Reading requests (servers)
Main article: asynchronous responses
Exact handling of is left to the discretion of the server.
If a server might in some cases return a status code signaling completion, and in other cases return an asynchronous 202 Accepted
, depending on runtime conditions, then the value of the wait
preference should influence how long the server will wait before sending 202 Accepted
. Send Preference-Applied if this preference was used to select a behavior.
Servers may implement this by scheduling a timeout at the start of the request, and if at the end of the timeout, the response has not started, then trigger the asynchronous response.
In other cases, this preference should be ignored.
Overview table
- Name
- wait
- Description
- Specifies client preferences for the server.
- Specification
- RFC 7240: Prefer Header for HTTP
Syntax
wait = "wait" BWS "=" BWS delta-seconds
Example
POST /collection HTTP/1.1
Host: example.org
Content-Type: text/plain
Prefer: respond-async, wait=10
{Data}