2015-11-06 22:55:41 +01:00
|
|
|
---
|
|
|
|
set: 4
|
|
|
|
code: 428
|
|
|
|
title: Precondition Required
|
2016-04-19 15:19:17 +02:00
|
|
|
references:
|
|
|
|
"Symfony HTTP Status Constant": "Response::HTTP_PRECONDITION_REQUIRED"
|
2015-11-06 22:55:41 +01:00
|
|
|
---
|
|
|
|
|
2015-11-09 02:44:05 +01:00
|
|
|
The origin server requires the request to be conditional.
|
2015-11-07 05:34:40 +01:00
|
|
|
|
|
|
|
Its typical use is to avoid the "lost update" problem, where a client GETs a
|
|
|
|
resource's state, modifies it, and PUTs it back to the server, when meanwhile a
|
|
|
|
third party has modified the state on the server, leading to a conflict. By
|
|
|
|
requiring requests to be conditional, the server can assure that clients are
|
|
|
|
working with the correct copies.
|
|
|
|
|
|
|
|
Responses using this status code SHOULD explain how to resubmit the request
|
|
|
|
successfully. For example:
|
|
|
|
|
|
|
|
```
|
|
|
|
HTTP/1.1 428 Precondition Required
|
|
|
|
Content-Type: text/html
|
|
|
|
|
|
|
|
<html>
|
2015-11-09 20:01:11 +01:00
|
|
|
<head>
|
|
|
|
<title>Precondition Required</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Precondition Required</h1>
|
|
|
|
<p>This request is required to be conditional; try using "If-Match".</p>
|
|
|
|
</body>
|
2015-11-07 05:34:40 +01:00
|
|
|
</html>
|
|
|
|
```
|
|
|
|
|
|
|
|
Responses with the 428 status code MUST NOT be stored by a cache.
|
|
|
|
|
2015-11-09 02:44:05 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
* Source: [RFC6585 Section 3][1]
|
|
|
|
|
2016-04-19 15:19:17 +02:00
|
|
|
[1]: <http://tools.ietf.org/html/rfc6585#section-3>
|