Skip to content

Commit 62812f2

Browse files
Http codes changed for RU
1 parent 900a18d commit 62812f2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

ru/reference/tutorial-rest.rst

+9-6
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,17 @@
295295
//Проверка, что вставка произведена успешно
296296
if ($status->success() == true) {
297297
298+
// Изменение HTML статуса
299+
$response->setStatusCode(201, "Created");
300+
298301
$robot->id = $status->getModel()->id;
299302
300303
$response->setJsonContent(array('status' => 'OK', 'data' => $robot));
301304
302305
} else {
303306
304307
// Изменение HTML статуса
305-
$response->setStatusCode(500, "Internal Error");
308+
$response->setStatusCode(409, "Conflict");
306309
307310
//Отправляем сообщение об ошибке клиенту
308311
$errors = array();
@@ -346,7 +349,7 @@
346349
} else {
347350
348351
//Изменение HTML статуса
349-
$response->setStatusCode(500, "Internal Error");
352+
$response->setStatusCode(409, "Conflict");
350353
351354
$errors = array();
352355
foreach ($status->getMessages() as $message) {
@@ -383,7 +386,7 @@
383386
} else {
384387
385388
// Изменение HTTP статуса
386-
$response->setStatusCode(500, "Internal Error");
389+
$response->setStatusCode(409, "Conflict");
387390
388391
$errors = array();
389392
foreach ($status->getMessages() as $message) {
@@ -450,7 +453,7 @@
450453
curl -i -X POST -d '{"name":"C-3PO","type":"droid","year":1977}'
451454
http://localhost/my-rest-api/api/robots
452455
453-
HTTP/1.1 200 OK
456+
HTTP/1.1 201 Created
454457
Date: Wed, 12 Sep 2012 07:15:09 GMT
455458
Server: Apache/2.2.22 (Unix) DAV/2
456459
Content-Length: 75
@@ -465,7 +468,7 @@
465468
curl -i -X POST -d '{"name":"C-3PO","type":"droid","year":1977}'
466469
http://localhost/my-rest-api/api/robots
467470
468-
HTTP/1.1 500 Internal Error
471+
HTTP/1.1 409 Conflict
469472
Date: Wed, 12 Sep 2012 07:18:28 GMT
470473
Server: Apache/2.2.22 (Unix) DAV/2
471474
Content-Length: 63
@@ -480,7 +483,7 @@
480483
curl -i -X PUT -d '{"name":"ASIMO","type":"humanoid","year":2000}'
481484
http://localhost/my-rest-api/api/robots/4
482485
483-
HTTP/1.1 500 Internal Error
486+
HTTP/1.1 409 Conflict
484487
Date: Wed, 12 Sep 2012 08:48:01 GMT
485488
Server: Apache/2.2.22 (Unix) DAV/2
486489
Content-Length: 104

0 commit comments

Comments
 (0)