Skip to content
Permalink
Browse files

Added `422 Unprocessable Entity` as suggested

>  The 412 (Precondition Failed) status code indicates that one or more
   conditions given in the request header fields evaluated to false when
   tested on the server.  This response code allows the client to place
   preconditions on the current resource state (its current
   representations and metadata) and, thus, prevent the request method
   from being applied if the target resource is in an unexpected state.
(http://tools.ietf.org/html/rfc7232#section-4.2)

> The 422 (Unprocessable Entity) status code means the server
   understands the content type of the request entity (hence a
   415(Unsupported Media Type) status code is inappropriate), and the
   syntax of the request entity is correct (thus a 400 (Bad Request)
   status code is inappropriate) but was unable to process the contained
   instructions.  For example, this error condition may occur if an XML
   request body contains well-formed (i.e., syntactically correct), but
   semantically erroneous, XML instructions.
(http://tools.ietf.org/html/rfc4918#section-11.2)
  • Loading branch information...
jadb committed Feb 11, 2016
1 parent 41d5b1c commit 91cff70922067f234af0a6dd264ab1b77eefa3af
Showing with 5 additions and 4 deletions.
  1. +1 −0 src/Network/Response.php
  2. +1 −1 src/TestSuite/IntegrationTestCase.php
  3. +3 −3 tests/TestCase/Network/ResponseTest.php
@@ -71,6 +71,7 @@ class Response
415 => 'Unsupported Media Type',
416 => 'Requested range not satisfiable',
417 => 'Expectation Failed',
422 => 'Unprocessable Entity',
429 => 'Too Many Requests',
500 => 'Internal Server Error',
501 => 'Not Implemented',
@@ -550,7 +550,7 @@ public function assertResponseSuccess()
*/
public function assertResponseError()
{
$this->_assertStatus(400, 417, 'Status code is not between 400 and 417');
$this->_assertStatus(400, 429, 'Status code is not between 400 and 429');
}
/**
@@ -448,7 +448,7 @@ public function testHttpCodes()
{
$response = new Response();
$result = $response->httpCodes();
$this->assertEquals(41, count($result));
$this->assertEquals(42, count($result));
$result = $response->httpCodes(100);
$expected = [100 => 'Continue'];
@@ -461,7 +461,7 @@ public function testHttpCodes()
$result = $response->httpCodes($codes);
$this->assertTrue($result);
$this->assertEquals(43, count($response->httpCodes()));
$this->assertEquals(44, count($response->httpCodes()));
$result = $response->httpCodes(381);
$expected = [381 => 'Unicorn Moved'];
@@ -470,7 +470,7 @@ public function testHttpCodes()
$codes = [404 => 'Sorry Bro'];
$result = $response->httpCodes($codes);
$this->assertTrue($result);
$this->assertEquals(43, count($response->httpCodes()));
$this->assertEquals(44, count($response->httpCodes()));
$result = $response->httpCodes(404);
$expected = [404 => 'Sorry Bro'];

0 comments on commit 91cff70

Please sign in to comment.
You can’t perform that action at this time.